TxBuilder: sign now signs inputs in known publicKey order

This commit is contained in:
Daniel Cousens 2014-12-12 15:19:03 +11:00
parent c29b233744
commit dfe74fa0d2
2 changed files with 51 additions and 10 deletions

View file

@ -184,6 +184,27 @@ describe('TransactionBuilder', function() {
}, /RedeemScript not supported \(nonstandard\)/)
})
})
it('throws if signature already exists', function() {
var redeemScript = scripts.multisigOutput(1, [privKey.pub])
txb.addInput(prevTxHash, 0)
txb.sign(0, privKey, redeemScript)
assert.throws(function() {
txb.sign(0, privKey, redeemScript)
}, /Signature already exists/)
})
it('throws if private key is unable to sign for that input', function() {
var redeemScript = scripts.multisigOutput(1, [privKey.pub])
txb.addInput(prevTxHash, 0)
assert.throws(function() {
txb.sign(0, ECKey.makeRandom(), redeemScript)
}, /privateKey cannot sign for this input/)
})
})
describe('build', function() {