integration: fix script usage in integration tests
This commit is contained in:
parent
e2abe2b3af
commit
1c92cfb373
2 changed files with 6 additions and 4 deletions
|
@ -55,7 +55,7 @@ describe('bitcoinjs-lib (advanced)', function () {
|
|||
|
||||
var actual = bitcoin.Transaction.fromHex(transaction.txHex)
|
||||
var dataScript2 = actual.outs[0].script
|
||||
var data2 = dataScript2.chunks[1]
|
||||
var data2 = bitcoin.scripts.decompile(dataScript2)[1]
|
||||
|
||||
assert.deepEqual(dataScript, dataScript2)
|
||||
assert.deepEqual(data, data2)
|
||||
|
|
|
@ -121,7 +121,9 @@ describe('bitcoinjs-lib (crypto)', function () {
|
|||
inputs.forEach(function (input) {
|
||||
var transaction = transactions[input.txId]
|
||||
var script = transaction.ins[input.vout].script
|
||||
assert(bitcoin.scripts.isPubKeyHashInput(script), 'Expected pubKeyHash script')
|
||||
var scriptChunks = bitcoin.scripts.decompile(script)
|
||||
|
||||
assert(bitcoin.scripts.isPubKeyHashInput(scriptChunks), 'Expected pubKeyHash script')
|
||||
|
||||
var prevOutTxId = bitcoin.bufferutils.reverse(transaction.ins[input.vout].hash).toString('hex')
|
||||
var prevVout = transaction.ins[input.vout].index
|
||||
|
@ -133,8 +135,8 @@ describe('bitcoinjs-lib (crypto)', function () {
|
|||
var prevOut = bitcoin.Transaction.fromHex(result.txHex)
|
||||
var prevOutScript = prevOut.outs[prevVout].script
|
||||
|
||||
var scriptSignature = bitcoin.ECSignature.parseScriptSignature(script.chunks[0])
|
||||
var publicKey = bitcoin.ECPair.fromPublicKeyBuffer(script.chunks[1])
|
||||
var scriptSignature = bitcoin.ECSignature.parseScriptSignature(scriptChunks[0])
|
||||
var publicKey = bitcoin.ECPair.fromPublicKeyBuffer(scriptChunks[1])
|
||||
|
||||
var m = transaction.hashForSignature(input.vout, prevOutScript, scriptSignature.hashType)
|
||||
assert(publicKey.verify(m, scriptSignature.signature), 'Invalid m')
|
||||
|
|
Loading…
Reference in a new issue