diff --git a/integration/regtest.js b/integration/regtest.js index 20dbb43b..64f67f27 100644 --- a/integration/regtest.js +++ b/integration/regtest.js @@ -304,6 +304,18 @@ describe('Daemon Binding Functionality', function() { }).should.throw('\x10: mandatory-script-verify-flag-failed (Operation not valid with the current stack size)'); }); + it('will throw an error for unexpected types', function() { + var garbage = new Buffer('abcdef', 'hex'); + (function() { + bitcoind.sendTransaction(garbage); + }).should.throw('TX decode failed'); + + var num = 23; + (function() { + bitcoind.sendTransaction(num); + }).should.throw('TX decode failed'); + }); + it('will emit "tx" events', function(done) { var tx = bitcore.Transaction(); tx.from(utxos[2]); diff --git a/lib/services/db.js b/lib/services/db.js index a5da6568..c78b6f33 100644 --- a/lib/services/db.js +++ b/lib/services/db.js @@ -365,7 +365,6 @@ DB.prototype.sendTransaction = function(tx, callback) { } else { txString = tx; } - $.checkArgument(typeof txString === 'string', 'Argument must be a hex string or Transaction'); try { var txid = this.node.services.bitcoind.sendTransaction(txString);