diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 590fa609a..bac2eac77 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -2177,7 +2177,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb) var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts); if (!ntxid) { - return cb(new Error('Error creating TX')); + return cb(new Error('Error creating the Transaction')); } self.sendIndexes(); @@ -2212,12 +2212,19 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos opts[k] = Wallet.builderOpts[k]; } - var b = new Builder(opts) + var b; + + try { + b = new Builder(opts) .setUnspent(utxos) .setOutputs([{ address: toAddress, amountSatStr: amountSatStr, }]); + } catch (e) { + log.debug(e.message); + return; + }; var selectedUtxos = b.getSelectedUnspent(); var inputChainPaths = selectedUtxos.map(function(utxo) {