From a90a8e061ed11a3ba6aaba79e8d2271a57a23f71 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 11 Jul 2014 19:18:27 +1000 Subject: [PATCH] Transaction: add assertion that scriptPubKey exists --- src/transaction.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/transaction.js b/src/transaction.js index 0926b84..80393b9 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -84,9 +84,11 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) { scriptPubKey = address.toOutputScript() } + assert(scriptPubKey instanceof Script, 'Expected Address or Script, got ' + scriptPubKey) + return (this.outs.push({ script: scriptPubKey, - value: value, + value: value }) - 1) }