Skip to content

Commit

Permalink
fix: deserializing multisig txs
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Aug 24, 2020
1 parent 34ba78c commit db6d264
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
34 changes: 6 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"bitcoinjs-lib": "^5.1.7",
"bluebird": "^3.7.2",
"bn.js": "^4.11.8",
"c32check": "^1.0.1",
"c32check": "^1.1.2",
"coinselect": "^3.1.12",
"compression": "^1.7.4",
"cors": "^2.8.5",
Expand Down
4 changes: 4 additions & 0 deletions src/p2p/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ interface TransactionSpendingConditionMultiSig {
nonce: bigint; // u64
feeRate: bigint; // u64
authFields: TransactionAuthField[];
/** A 2-byte signature count indicating the number of signatures that are required for the authorization to be valid */
signatureCount: number; //u16
}

export enum TransactionAuthTypeID {
Expand Down Expand Up @@ -579,6 +581,7 @@ function readTransactionSpendingCondition(reader: BufferReader): TransactionSpen
nonce: reader.readBigUInt64BE(),
feeRate: reader.readBigUInt64BE(),
authFields: new Array<TransactionAuthField>(reader.readUInt32BE()),
signatureCount: -1,
};
for (let i = 0; i < condition.authFields.length; i++) {
const authType = reader.readUInt8Enum(TransactionAuthFieldTypeID, n => {
Expand Down Expand Up @@ -608,6 +611,7 @@ function readTransactionSpendingCondition(reader: BufferReader): TransactionSpen
);
}
}
condition.signatureCount = reader.readUInt16BE();
return condition;
} else {
throw new NotImplementedError(
Expand Down

0 comments on commit db6d264

Please sign in to comment.