TransactionBuilder: avoid unnecessary cache object
This commit is contained in:
parent
49c6ebe3a0
commit
fbcc23fa14
1 changed files with 4 additions and 2 deletions
|
@ -16,7 +16,7 @@ var Transaction = require('./transaction')
|
|||
function fixMSSignatures (transaction, vin, pubKeys, signatures, prevOutScript, hashType, skipPubKey) {
|
||||
// maintain a local copy of unmatched signatures
|
||||
var unmatched = signatures.slice()
|
||||
var cache = {}
|
||||
var signatureHash
|
||||
|
||||
return pubKeys.map(function (pubKey) {
|
||||
// skip optionally provided pubKey
|
||||
|
@ -30,7 +30,9 @@ function fixMSSignatures (transaction, vin, pubKeys, signatures, prevOutScript,
|
|||
// skip if undefined || OP_0
|
||||
if (!signature) return false
|
||||
|
||||
var signatureHash = cache[hashType] = cache[hashType] || transaction.hashForSignature(vin, prevOutScript, hashType)
|
||||
if (!signatureHash) {
|
||||
signatureHash = transaction.hashForSignature(vin, prevOutScript, hashType)
|
||||
}
|
||||
if (!keyPair2.verify(signatureHash, signature)) return false
|
||||
|
||||
// remove matched signature from unmatched
|
||||
|
|
Loading…
Reference in a new issue