tests: add witness support to fromRaw
This commit is contained in:
parent
5150e3c027
commit
a1755a43c0
1 changed files with 9 additions and 1 deletions
|
@ -13,7 +13,7 @@ describe('Transaction', function () {
|
||||||
tx.version = raw.version
|
tx.version = raw.version
|
||||||
tx.locktime = raw.locktime
|
tx.locktime = raw.locktime
|
||||||
|
|
||||||
raw.ins.forEach(function (txIn) {
|
raw.ins.forEach(function (txIn, i) {
|
||||||
var txHash = new Buffer(txIn.hash, 'hex')
|
var txHash = new Buffer(txIn.hash, 'hex')
|
||||||
var scriptSig
|
var scriptSig
|
||||||
|
|
||||||
|
@ -24,6 +24,14 @@ describe('Transaction', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.addInput(txHash, txIn.index, txIn.sequence, scriptSig)
|
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) {
|
raw.outs.forEach(function (txOut) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue