From 4f1e13a6868490c0717411bad44ac0a8872bc9cc Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Thu, 5 Feb 2015 11:58:00 -0300 Subject: [PATCH] UnspentOutput: Fix issue when 0 being feed as amount --- lib/transaction/unspentoutput.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transaction/unspentoutput.js b/lib/transaction/unspentoutput.js index f02dc79..e5e71f5 100644 --- a/lib/transaction/unspentoutput.js +++ b/lib/transaction/unspentoutput.js @@ -41,9 +41,9 @@ function UnspentOutput(data) { if (!_.isNumber(outputIndex)) { throw new Error('Invalid outputIndex, received ' + outputIndex); } - $.checkArgument(data.scriptPubKey || data.script, 'Must provide the scriptPubKey for that output!'); + $.checkArgument(!_.isUndefined(data.scriptPubKey || data.script), 'Must provide the scriptPubKey for that output!'); var script = new Script(data.scriptPubKey || data.script); - $.checkArgument(data.amount || data.satoshis, 'Must provide the scriptPubKey for that output!'); + $.checkArgument(!_.isUndefined(data.amount || data.satoshis), 'Must provide an amount for the output'); var amount = data.amount ? new Unit.fromBTC(data.amount).toSatoshis() : data.satoshis; $.checkArgument(_.isNumber(amount), 'Amount must be a number'); JSUtil.defineImmutable(this, {