ECPair: cease using Address for address encoding
This commit is contained in:
parent
5ce093739e
commit
588b346f5d
10 changed files with 27 additions and 22 deletions
|
@ -1,4 +1,5 @@
|
|||
var assert = require('assert')
|
||||
var bcrypto = require('./crypto')
|
||||
var bufferutils = require('./bufferutils')
|
||||
var ops = require('./opcodes')
|
||||
var scripts = require('./scripts')
|
||||
|
@ -36,7 +37,7 @@ function extractInput (txIn) {
|
|||
hashType = parsed.hashType
|
||||
pubKeys = scriptSig.chunks.slice(1)
|
||||
signatures = [parsed.signature]
|
||||
prevOutScript = ECPair.fromPublicKeyBuffer(pubKeys[0]).getAddress().toOutputScript()
|
||||
prevOutScript = Address.fromBase58Check(ECPair.fromPublicKeyBuffer(pubKeys[0]).getAddress()).toOutputScript()
|
||||
|
||||
break
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ TransactionBuilder.prototype.sign = function (index, keyPair, redeemScript, hash
|
|||
|
||||
case 'pubkeyhash': {
|
||||
var pkh1 = redeemScript.chunks[2]
|
||||
var pkh2 = keyPair.getAddress().hash
|
||||
var pkh2 = bcrypto.hash160(keyPair.getPublicKeyBuffer())
|
||||
|
||||
assert.deepEqual(pkh1, pkh2, 'privateKey cannot sign for this input')
|
||||
pubKeys = [kpPubKey]
|
||||
|
@ -362,7 +363,7 @@ TransactionBuilder.prototype.sign = function (index, keyPair, redeemScript, hash
|
|||
|
||||
// we know nothin' Jon Snow, assume pubKeyHash
|
||||
} else {
|
||||
input.prevOutScript = keyPair.getAddress().toOutputScript()
|
||||
input.prevOutScript = Address.fromBase58Check(keyPair.getAddress()).toOutputScript()
|
||||
input.prevOutType = 'pubkeyhash'
|
||||
input.pubKeys = [kpPubKey]
|
||||
input.scriptType = input.prevOutType
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue