TxBuilder: avoid use of network dependent functions where possible

This commit is contained in:
Daniel Cousens 2015-07-24 12:08:15 +10:00
parent 92b336fd0f
commit 37d094c179

View file

@ -37,7 +37,7 @@ function extractInput (txIn) {
hashType = parsed.hashType
pubKeys = scriptSig.chunks.slice(1)
signatures = [parsed.signature]
prevOutScript = Address.toOutputScript(ECPair.fromPublicKeyBuffer(pubKeys[0]).getAddress())
prevOutScript = scripts.pubKeyHashOutput(bcrypto.hash160(pubKeys[0]))
break
}
@ -358,7 +358,7 @@ TransactionBuilder.prototype.sign = function (index, keyPair, redeemScript, hash
// we know nothin' Jon Snow, assume pubKeyHash
} else {
input.prevOutScript = Address.toOutputScript(keyPair.getAddress())
input.prevOutScript = scripts.pubKeyHashOutput(bcrypto.hash160(keyPair.getPublicKeyBuffer()))
input.prevOutType = 'pubkeyhash'
input.pubKeys = [kpPubKey]
input.scriptType = input.prevOutType