Browse Source

integration: return funds to our faucet

hk-custom-address
Daniel Cousens 8 years ago
committed by Daniel Cousens
parent
commit
52bcfe72be
  1. 2
      test/integration/_blockchain.js
  2. 1
      test/integration/advanced.js
  3. 2
      test/integration/basic.js
  4. 6
      test/integration/cltv.js
  5. 4
      test/integration/multisig.js

2
test/integration/_blockchain.js

@ -59,6 +59,8 @@ testnet.faucet = function faucet (address, value, callback) {
})
}
testnet.RETURN = kpAddress
module.exports = {
m: mainnet,
t: testnet

1
test/integration/advanced.js

@ -20,6 +20,7 @@ describe('bitcoinjs-lib (advanced)', function () {
tx.addInput(unspent.txId, unspent.vout)
tx.addOutput(dataScript, 1000)
tx.addOutput(blockchain.t.RETURN, 1e4)
tx.sign(0, keyPair)
var txRaw = tx.build()

2
test/integration/basic.js

@ -83,7 +83,7 @@ describe('bitcoinjs-lib (basic)', function () {
var tx = new bitcoin.TransactionBuilder(network)
tx.addInput(unspents[0].txId, unspents[0].vout)
tx.addInput(unspents[1].txId, unspents[1].vout)
tx.addOutput('n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi', 1e4)
tx.addOutput(blockchain.t.RETURN, 1e4)
tx.addOutput('mvGVHWi6gbkBZZPaqBVRcxvKVPYd9r3fp7', 1e4)
tx.sign(0, alice)
tx.sign(1, bob)

6
test/integration/cltv.js

@ -49,7 +49,7 @@ describe('bitcoinjs-lib (CLTV)', function () {
var tx = new bitcoin.TransactionBuilder(network)
tx.setLockTime(timeUtc)
tx.addInput(unspent.txId, 0, 0xfffffffe)
tx.addOutput('n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi', 1e4)
tx.addOutput(blockchain.t.RETURN, 1e4)
var txRaw = tx.buildIncomplete()
var signatureHash = txRaw.hashForSignature(0, redeemScript, hashType)
@ -82,7 +82,7 @@ describe('bitcoinjs-lib (CLTV)', function () {
var tx = new bitcoin.TransactionBuilder(network)
tx.addInput(unspent.txId, 0, 0xfffffffe)
tx.addOutput('n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi', 1e4)
tx.addOutput(blockchain.t.RETURN, 1e4)
var txRaw = tx.buildIncomplete()
var signatureHash = txRaw.hashForSignature(0, redeemScript, hashType)
@ -115,7 +115,7 @@ describe('bitcoinjs-lib (CLTV)', function () {
var tx = new bitcoin.TransactionBuilder(network)
tx.setLockTime(timeUtc)
tx.addInput(unspent.txId, 0, 0xfffffffe)
tx.addOutput('n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi', 1e4)
tx.addOutput(blockchain.t.RETURN, 1e4)
var txRaw = tx.buildIncomplete()
var signatureHash = txRaw.hashForSignature(0, redeemScript, hashType)

4
test/integration/multisig.js

@ -43,7 +43,7 @@ describe('bitcoinjs-lib (multisig)', function () {
var txb = new bitcoin.TransactionBuilder(bitcoin.networks.testnet)
txb.addInput(unspent.txId, unspent.vout)
txb.addOutput('n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi', 1e4)
txb.addOutput(blockchain.t.RETURN, 1e4)
// sign with 1st and 3rd key
txb.sign(0, keyPairs[0], redeemScript)
@ -60,7 +60,7 @@ describe('bitcoinjs-lib (multisig)', function () {
async.retry(5, function (callback) {
setTimeout(function () {
// check that the above transaction included the intended address
blockchain.t.addresses.unspents('n2eMqTT929pb1RDNuqEnxdaLau1rxy3efi', function (err, unspents) {
blockchain.t.addresses.unspents(blockchain.t.RETURN, function (err, unspents) {
if (err) return callback(err)
if (!unspents.some(function (unspent) {
return unspent.txId === txId && unspent.value === 1e4

Loading…
Cancel
Save