From a1755a43c016188fbc9560e738658870940aeec4 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Mon, 14 Nov 2016 13:40:29 +1100 Subject: [PATCH] tests: add witness support to fromRaw --- test/transaction.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/transaction.js b/test/transaction.js index 904ecde..ee2e947 100644 --- a/test/transaction.js +++ b/test/transaction.js @@ -13,7 +13,7 @@ describe('Transaction', function () { tx.version = raw.version tx.locktime = raw.locktime - raw.ins.forEach(function (txIn) { + raw.ins.forEach(function (txIn, i) { var txHash = new Buffer(txIn.hash, 'hex') var scriptSig @@ -24,6 +24,14 @@ describe('Transaction', function () { } tx.addInput(txHash, txIn.index, txIn.sequence, scriptSig) + + if (txIn.witness) { + var witness = txIn.witness.map(function (x) { + return new Buffer(x, 'hex') + }) + + tx.setWitness(i, witness) + } }) raw.outs.forEach(function (txOut) {