tests: add failing staged transaction building example #901
This commit is contained in:
parent
f4a83f8aed
commit
c729d322c2
2 changed files with 42 additions and 0 deletions
|
@ -51,6 +51,7 @@ function construct (f, dontSign) {
|
|||
|
||||
if (dontSign) return txb
|
||||
|
||||
var stages = f.stages && f.stages.concat()
|
||||
f.inputs.forEach(function (input, index) {
|
||||
if (!input.signs) return
|
||||
input.signs.forEach(function (sign) {
|
||||
|
@ -68,6 +69,12 @@ function construct (f, dontSign) {
|
|||
witnessScript = bscript.fromASM(sign.witnessScript)
|
||||
}
|
||||
txb.sign(index, keyPair, redeemScript, sign.hashType, value, witnessScript)
|
||||
|
||||
if (sign.stage) {
|
||||
var tx = txb.buildIncomplete()
|
||||
assert.strictEqual(tx.toHex(), stages.shift())
|
||||
txb = TransactionBuilder.fromTransaction(tx, network)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue