diff --git a/test/integration/advanced.js b/test/integration/advanced.js index c8f1f7a..6473e08 100644 --- a/test/integration/advanced.js +++ b/test/integration/advanced.js @@ -34,12 +34,19 @@ describe('bitcoinjs-lib (advanced)', function () { blockchain.t.addresses.unspents(address, function (err, unspents) { if (err) return done(err) + // filter small unspents + unspents = unspents.filter(function (unspent) { + return unspent.value > 1e4 + }) + + // use the oldest unspent + var unspent = unspents.pop() + if (!unspent) throw new Error('Faucet didn\'t provide an unspent') + var tx = new bitcoin.TransactionBuilder(network) var data = new Buffer('bitcoinjs-lib') var dataScript = bitcoin.script.nullDataOutput(data) - var unspent = unspents.pop() - tx.addInput(unspent.txId, unspent.vout) tx.addOutput(dataScript, 1000) tx.sign(0, keyPair) diff --git a/test/integration/multisig.js b/test/integration/multisig.js index df1f868..409b2a5 100644 --- a/test/integration/multisig.js +++ b/test/integration/multisig.js @@ -51,6 +51,7 @@ describe('bitcoinjs-lib (multisig)', function () { // use the oldest unspent var unspent = unspents.pop() + if (!unspent) throw new Error('Faucet didn\'t provide an unspent') // make a random destination address var targetAddress = bitcoin.ECPair.makeRandom({