fixes handling wrong txs
This commit is contained in:
parent
f26f2d0453
commit
22ef1bb3f3
2 changed files with 6 additions and 3 deletions
|
|
@ -256,7 +256,7 @@ Insight.prototype.broadcast = function(rawtx, cb) {
|
|||
this.requestPost('/api/tx/send', {
|
||||
rawtx: rawtx
|
||||
}, function(err, res, body) {
|
||||
if (err || res.status != 200) cb(err || res);
|
||||
if (err || res.statusCode != 200) cb(err || body);
|
||||
cb(null, body ? body.txid : null);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1381,14 +1381,17 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
|
|||
|
||||
var self = this;
|
||||
this.blockchain.broadcast(txHex, function(err, txid) {
|
||||
log.debug('Wallet:' + self.id + ' BITCOIND txid:', txid);
|
||||
if (err)
|
||||
log.error('Error sending TX:',err);
|
||||
|
||||
if (txid) {
|
||||
log.debug('Wallet:' + self.getName() + ' Broadcasted TX. BITCOIND txid:', txid);
|
||||
self.txProposals.get(ntxid).setSent(txid);
|
||||
self.sendTxProposal(ntxid);
|
||||
self.emitAndKeepAlive('txProposalsUpdated');
|
||||
return cb(txid);
|
||||
} else {
|
||||
log.debug('Wallet:' + self.id + ' Sent failed. Checking if the TX was sent already');
|
||||
log.info('Wallet:' + self.getName() + '. Sent failed. Checking if the TX was sent already');
|
||||
self._checkSentTx(ntxid, function(txid) {
|
||||
if (txid)
|
||||
self.emitAndKeepAlive('txProposalsUpdated');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue