From f13650544bbf078d247148ced2ca24fae8792f0a Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 19 Feb 2015 12:03:41 +1100 Subject: [PATCH] Transaction: add internal flag to disable size assertion --- src/transaction.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index 31c8657..6202fbe 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -22,7 +22,7 @@ Transaction.SIGHASH_NONE = 0x02 Transaction.SIGHASH_SINGLE = 0x03 Transaction.SIGHASH_ANYONECANPAY = 0x80 -Transaction.fromBuffer = function(buffer) { +Transaction.fromBuffer = function(buffer, __disableAssert) { var offset = 0 function readSlice(n) { offset += n @@ -73,7 +73,10 @@ Transaction.fromBuffer = function(buffer) { } tx.locktime = readUInt32() - assert.equal(offset, buffer.length, 'Transaction has unexpected data') + + if (!__disableAssert) { + assert.equal(offset, buffer.length, 'Transaction has unexpected data') + } return tx }