Browse Source

TxBuilder: avoid unnecessary recalculation of prevOutScript data

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
aa80bde815
  1. 9
      src/transaction_builder.js

9
src/transaction_builder.js

@ -231,13 +231,18 @@ TransactionBuilder.prototype.sign = function(index, privKey, redeemScript, hashT
} else {
prevOutScript = prevOutScript || privKey.pub.getAddress().toOutputScript()
scriptType = prevOutType || 'pubkeyhash'
prevOutType = prevOutType || 'pubkeyhash'
assert.notEqual(scriptType, 'scripthash', 'PrevOutScript requires redeemScript')
assert.notEqual(prevOutType, 'scripthash', 'PrevOutScript is P2SH, missing redeemScript')
scriptType = prevOutType
hash = this.tx.hashForSignature(index, prevOutScript, hashType)
}
this.prevOutScripts[index] = prevOutScript
this.prevOutTypes[index] = prevOutType
if (!(index in this.signatures)) {
this.signatures[index] = {
hashType: hashType,

Loading…
Cancel
Save