Skip to content

Commit be1f555

Browse files
spkjpfaustbrian
authored andcommitted
fix: skip recipient id in toBytes for tx type 1 and 4 (#18)
* fix: skip recipient id in toBytes for type 1 and 4 * chore: 0.2.3 changelog
1 parent 0853b08 commit be1f555

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## Unreleased
99

10+
## 0.2.3
11+
12+
### Fixed
13+
- Skip recipient id in `toBytes` for type 1 and 4 transactions.
14+
1015
## 0.2.2 - 2018-07-31
1116

1217
### Fixed

src/Transactions/Transaction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ public function toBytes(bool $skipSignature = true, bool $skipSecondSignature =
181181
$buffer->writeUInt32($this->timestamp);
182182
$buffer->writeHex($this->senderPublicKey);
183183

184-
if (isset($this->recipientId)) {
184+
$skipRecipientId = $this->type === Types::SECOND_SIGNATURE_REGISTRATION || $this->type === Types::MULTI_SIGNATURE_REGISTRATION;
185+
if (isset($this->recipientId) && !$skipRecipientId) {
185186
$buffer->writeHex(Base58::decodeCheck($this->recipientId)->getHex());
186187
} else {
187188
$buffer->fill(21);

tests/Concerns/Deserialize.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ protected function assertDeserialized(array $expected, array $keys, int $network
2727
$this->assertSame($network, $actual->network);
2828
$this->assertSame($expected['serialized'], Serializer::new($actual->toArray())->serialize()->getHex());
2929
$this->assertSameTransactions($expected, $actual, $keys);
30+
$this->assertTrue($actual->verify());
3031

3132
return $actual;
3233
}

0 commit comments

Comments
 (0)