Skip to content

Commit

Permalink
rename getPKB to getPK
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed May 22, 2018
1 parent ab0cc6c commit 08fab31
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/integration/addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('bitcoinjs-lib (addresses)', function () {

it('can generate a SegWit address', function () {
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct')
var pubKey = keyPair.getPublicKeyBuffer()
var pubKey = keyPair.getPublicKey()

var scriptPubKey = bitcoin.script.witnessPubKeyHash.output.encode(bitcoin.crypto.hash160(pubKey))
var address = bitcoin.address.fromOutputScript(scriptPubKey)
Expand All @@ -58,7 +58,7 @@ describe('bitcoinjs-lib (addresses)', function () {

it('can generate a SegWit address (via P2SH)', function () {
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct')
var pubKey = keyPair.getPublicKeyBuffer()
var pubKey = keyPair.getPublicKey()

var redeemScript = bitcoin.script.witnessPubKeyHash.output.encode(bitcoin.crypto.hash160(pubKey))
var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript))
Expand Down
4 changes: 2 additions & 2 deletions test/integration/cltv.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ describe('bitcoinjs-lib (transactions w/ CLTV)', function () {
bitcoin.opcodes.OP_DROP,

bitcoin.opcodes.OP_ELSE,
bQ.getPublicKeyBuffer(),
bQ.getPublicKey(),
bitcoin.opcodes.OP_CHECKSIGVERIFY,
bitcoin.opcodes.OP_ENDIF,

aQ.getPublicKeyBuffer(),
aQ.getPublicKey(),
bitcoin.opcodes.OP_CHECKSIG
])
}
Expand Down
8 changes: 4 additions & 4 deletions test/integration/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('bitcoinjs-lib (transactions)', function () {
'91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgx3cTMqe',
'91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjJoQFacbgx9rcrL7'
].map(function (wif) { return bitcoin.ECPair.fromWIF(wif, regtest) })
var pubKeys = keyPairs.map(function (x) { return x.getPublicKeyBuffer() })
var pubKeys = keyPairs.map(function (x) { return x.getPublicKey() })

var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys)
var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript))
Expand Down Expand Up @@ -142,7 +142,7 @@ describe('bitcoinjs-lib (transactions)', function () {
this.timeout(30000)

var keyPair = bitcoin.ECPair.fromWIF('cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87JcbXMTcA', regtest)
var pubKey = keyPair.getPublicKeyBuffer()
var pubKey = keyPair.getPublicKey()
var pubKeyHash = bitcoin.crypto.hash160(pubKey)

var redeemScript = bitcoin.script.witnessPubKeyHash.output.encode(pubKeyHash)
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('bitcoinjs-lib (transactions)', function () {
'cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87KcLPVfXz',
'cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN87L7FgDCKE'
].map(function (wif) { return bitcoin.ECPair.fromWIF(wif, regtest) })
var pubKeys = keyPairs.map(function (x) { return x.getPublicKeyBuffer() })
var pubKeys = keyPairs.map(function (x) { return x.getPublicKey() })

var witnessScript = bitcoin.script.multisig.output.encode(3, pubKeys)
var redeemScript = bitcoin.script.witnessScriptHash.output.encode(bitcoin.crypto.sha256(witnessScript))
Expand Down Expand Up @@ -233,7 +233,7 @@ describe('bitcoinjs-lib (transactions)', function () {
var ss = bitcoin.script.signature.decode(scriptSig.signature)
var hash = tx.hashForSignature(i, prevOutScript, ss.hashType)

assert.strictEqual(scriptSig.pubKey.toString('hex'), keyPair.getPublicKeyBuffer().toString('hex'))
assert.strictEqual(scriptSig.pubKey.toString('hex'), keyPair.getPublicKey().toString('hex'))
assert.strictEqual(keyPair.verify(hash, ss.signature), true)
})
})
Expand Down

0 comments on commit 08fab31

Please sign in to comment.