Browse Source

TxBuilder: sign after error checking

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
14211b5f3e
  1. 8
      src/transaction_builder.js

8
src/transaction_builder.js

@ -94,8 +94,6 @@ TransactionBuilder.prototype.sign = function(index, privKey, redeemScript, hashT
hash = this.tx.hashForSignature(index, prevOutScript, hashType)
}
var signature = privKey.sign(hash)
if (!(index in this.signatures)) {
this.signatures[index] = {
hashType: hashType,
@ -107,11 +105,13 @@ TransactionBuilder.prototype.sign = function(index, privKey, redeemScript, hashT
}
var input = this.signatures[index]
input.pubKeys.push(privKey.pub)
input.signatures.push(signature)
assert.equal(input.hashType, hashType, 'Inconsistent hashType')
assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript')
var signature = privKey.sign(hash)
input.pubKeys.push(privKey.pub)
input.signatures.push(signature)
}
TransactionBuilder.prototype.build = function() {

Loading…
Cancel
Save