Skip to content

Commit

Permalink
fix: always deserialize vendor field
Browse files Browse the repository at this point in the history
  • Loading branch information
spkjp committed Jun 7, 2019
1 parent 5137ca3 commit b537d6f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/crypto/src/transactions/deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ class Deserializer {
const vendorFieldLength: number = buf.readUint8();
if (vendorFieldLength > 0) {
if (transaction.hasVendorField()) {
transaction.data.vendorFieldHex = buf.readBytes(vendorFieldLength).toString("hex");
const vendorFieldBuffer: Buffer = buf.readBytes(vendorFieldLength).toBuffer();
transaction.data.vendorFieldHex = vendorFieldBuffer.toString("hex"); // TODO: purpose?
transaction.data.vendorField = vendorFieldBuffer.toString("utf8");
} else {
buf.skip(vendorFieldLength);
}
Expand Down Expand Up @@ -158,10 +160,6 @@ class Deserializer {
k.startsWith("+") ? k : `+${k}`,
);
}

if (transaction.vendorFieldHex) {
transaction.vendorField = Buffer.from(transaction.vendorFieldHex, "hex").toString("utf8");
}
}

private getByteBuffer(serialized: Buffer | string): ByteBuffer {
Expand Down

0 comments on commit b537d6f

Please sign in to comment.