From 31ab9bfc03b26fe73454d8c3b2b58cd23caee629 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 20 Jul 2018 17:35:34 +1000 Subject: [PATCH] tests/integration: throw verbose error if unspent is missing --- test/integration/_regtest.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/integration/_regtest.js b/test/integration/_regtest.js index 0f39fad..059cec2 100644 --- a/test/integration/_regtest.js +++ b/test/integration/_regtest.js @@ -38,7 +38,10 @@ function faucet (address, value, callback) { unspents(address, function (err, results) { if (err) return callback(err) - callback(null, results.filter(x => x.txId === txId).pop()) + const unspents = results.filter(x => x.txId === txId) + if (unspents.length === 0) return callback(new Error('Missing unspent')) + + callback(null, unspents.pop()) }) }) }