From 22ef1bb3f33bf2f8b76109a8d31737c697339adc Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sun, 2 Nov 2014 22:41:04 -0300 Subject: [PATCH] fixes handling wrong txs --- js/models/Insight.js | 2 +- js/models/Wallet.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/models/Insight.js b/js/models/Insight.js index 091ccfb47..439aced7f 100644 --- a/js/models/Insight.js +++ b/js/models/Insight.js @@ -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); }); }; diff --git a/js/models/Wallet.js b/js/models/Wallet.js index 37bb4cb42..d52dc8bc5 100644 --- a/js/models/Wallet.js +++ b/js/models/Wallet.js @@ -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');