diff --git a/test/integration/advanced.js b/test/integration/advanced.js index f778e00..1bc612a 100644 --- a/test/integration/advanced.js +++ b/test/integration/advanced.js @@ -16,7 +16,7 @@ describe('bitcoinjs-lib (advanced)', function () { var tx = new bitcoin.TransactionBuilder(network) var data = new Buffer('bitcoinjs-lib') - var dataScript = bitcoin.script.nullDataOutput(data) + var dataScript = bitcoin.script.nullData.output.encode(data) tx.addInput(unspent.txId, unspent.vout) tx.addOutput(dataScript, 1000) diff --git a/test/integration/cltv.js b/test/integration/cltv.js index 21eab66..b3bb4c0 100644 --- a/test/integration/cltv.js +++ b/test/integration/cltv.js @@ -39,7 +39,7 @@ describe('bitcoinjs-lib (CLTV)', function () { // three hours ago var timeUtc = utcNow() - (3600 * 3) var redeemScript = cltvCheckSigOutput(alice, bob, timeUtc) - var scriptPubKey = bitcoin.script.scriptHashOutput(bitcoin.crypto.hash160(redeemScript)) + var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) var address = bitcoin.address.fromOutputScript(scriptPubKey, network) // fund the P2SH(CLTV) address @@ -55,7 +55,7 @@ describe('bitcoinjs-lib (CLTV)', function () { var signatureHash = txRaw.hashForSignature(0, redeemScript, hashType) // {Alice's signature} OP_TRUE - var redeemScriptSig = bitcoin.script.scriptHashInput([ + var redeemScriptSig = bitcoin.script.scriptHash.input.encode([ alice.sign(signatureHash).toScriptSignature(hashType), bitcoin.opcodes.OP_TRUE ], redeemScript) @@ -73,7 +73,7 @@ describe('bitcoinjs-lib (CLTV)', function () { // two hours ago var timeUtc = utcNow() - (3600 * 2) var redeemScript = cltvCheckSigOutput(alice, bob, timeUtc) - var scriptPubKey = bitcoin.script.scriptHashOutput(bitcoin.crypto.hash160(redeemScript)) + var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) var address = bitcoin.address.fromOutputScript(scriptPubKey, network) // fund the P2SH(CLTV) address @@ -86,7 +86,7 @@ describe('bitcoinjs-lib (CLTV)', function () { var txRaw = tx.buildIncomplete() var signatureHash = txRaw.hashForSignature(0, redeemScript, hashType) - var redeemScriptSig = bitcoin.script.scriptHashInput([ + var redeemScriptSig = bitcoin.script.scriptHash.input.encode([ alice.sign(signatureHash).toScriptSignature(hashType), bob.sign(signatureHash).toScriptSignature(hashType), bitcoin.opcodes.OP_FALSE @@ -105,7 +105,7 @@ describe('bitcoinjs-lib (CLTV)', function () { // two hours from now var timeUtc = utcNow() + (3600 * 2) var redeemScript = cltvCheckSigOutput(alice, bob, timeUtc) - var scriptPubKey = bitcoin.script.scriptHashOutput(bitcoin.crypto.hash160(redeemScript)) + var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) var address = bitcoin.address.fromOutputScript(scriptPubKey, network) // fund the P2SH(CLTV) address @@ -121,7 +121,7 @@ describe('bitcoinjs-lib (CLTV)', function () { var signatureHash = txRaw.hashForSignature(0, redeemScript, hashType) // {Alice's signature} OP_TRUE - var redeemScriptSig = bitcoin.script.scriptHashInput([ + var redeemScriptSig = bitcoin.script.scriptHash.input.encode([ alice.sign(signatureHash).toScriptSignature(hashType), bitcoin.opcodes.OP_TRUE ], redeemScript) diff --git a/test/integration/crypto.js b/test/integration/crypto.js index 84fc9ca..4b3674c 100644 --- a/test/integration/crypto.js +++ b/test/integration/crypto.js @@ -91,7 +91,7 @@ describe('bitcoinjs-lib (crypto)', function () { var script = transaction.ins[input.vout].script var scriptChunks = bitcoin.script.decompile(script) - assert(bitcoin.script.isPubKeyHashInput(scriptChunks), 'Expected pubKeyHash script') + assert(bitcoin.script.pubKeyHash.input.check(scriptChunks), 'Expected pubKeyHash script') var prevOutTxId = [].reverse.call(new Buffer(transaction.ins[input.vout].hash)).toString('hex') var prevVout = transaction.ins[input.vout].index diff --git a/test/integration/multisig.js b/test/integration/multisig.js index fbb4bd8..1d4c06f 100644 --- a/test/integration/multisig.js +++ b/test/integration/multisig.js @@ -15,8 +15,8 @@ describe('bitcoinjs-lib (multisig)', function () { return new Buffer(hex, 'hex') }) - var redeemScript = bitcoin.script.multisigOutput(2, pubKeys) // 2 of 3 - var scriptPubKey = bitcoin.script.scriptHashOutput(bitcoin.crypto.hash160(redeemScript)) + var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys) // 2 of 3 + var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) var address = bitcoin.address.fromOutputScript(scriptPubKey) assert.strictEqual(address, '36NUkt6FWUi3LAWBqWRdDmdTWbt91Yvfu7') @@ -33,8 +33,8 @@ describe('bitcoinjs-lib (multisig)', function () { ].map(function (wif) { return bitcoin.ECPair.fromWIF(wif, bitcoin.networks.testnet) }) var pubKeys = keyPairs.map(function (x) { return x.getPublicKeyBuffer() }) - var redeemScript = bitcoin.script.multisigOutput(2, pubKeys) // 2 of 4 - var scriptPubKey = bitcoin.script.scriptHashOutput(bitcoin.crypto.hash160(redeemScript)) + var redeemScript = bitcoin.script.multisig.output.encode(2, pubKeys) // 2 of 4 + var scriptPubKey = bitcoin.script.scriptHash.output.encode(bitcoin.crypto.hash160(redeemScript)) var address = bitcoin.address.fromOutputScript(scriptPubKey, bitcoin.networks.testnet) // attempt to send funds to the source address