Catch error when TransactionBuilder
This commit is contained in:
parent
2e70b50943
commit
d8c3f9451d
1 changed files with 9 additions and 2 deletions
|
|
@ -2177,7 +2177,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb)
|
||||||
|
|
||||||
var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts);
|
var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts);
|
||||||
if (!ntxid) {
|
if (!ntxid) {
|
||||||
return cb(new Error('Error creating TX'));
|
return cb(new Error('Error creating the Transaction'));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sendIndexes();
|
self.sendIndexes();
|
||||||
|
|
@ -2212,12 +2212,19 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, comment, utxos
|
||||||
opts[k] = Wallet.builderOpts[k];
|
opts[k] = Wallet.builderOpts[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
var b = new Builder(opts)
|
var b;
|
||||||
|
|
||||||
|
try {
|
||||||
|
b = new Builder(opts)
|
||||||
.setUnspent(utxos)
|
.setUnspent(utxos)
|
||||||
.setOutputs([{
|
.setOutputs([{
|
||||||
address: toAddress,
|
address: toAddress,
|
||||||
amountSatStr: amountSatStr,
|
amountSatStr: amountSatStr,
|
||||||
}]);
|
}]);
|
||||||
|
} catch (e) {
|
||||||
|
log.debug(e.message);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
var selectedUtxos = b.getSelectedUnspent();
|
var selectedUtxos = b.getSelectedUnspent();
|
||||||
var inputChainPaths = selectedUtxos.map(function(utxo) {
|
var inputChainPaths = selectedUtxos.map(function(utxo) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue