diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index d50d2563..65e18dea 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -625,6 +625,7 @@ Bitcoin.prototype._updateTip = function (node, message) { self.emit("error", error); } else { self.height = response.result.height; + self.tipTime = response.result.time; $.checkState(self.height >= 0); self.emit("tip", self.height); } @@ -861,6 +862,7 @@ Bitcoin.prototype._loadTipFromNode = function (node, callback) { return callback(self._wrapRPCError(err)); } self.height = response.result.height; + self.tipTime = response.result.time; $.checkState(self.height >= 0); self.emit("tip", self.height); callback(); @@ -2162,6 +2164,7 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { }); } else { self._tryAllClients(function (client, done) { + let transactionData = {}; async.series( [ function (callback) { @@ -2228,12 +2231,14 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { } // Sapling END - self.transactionDetailedCache.set(txid, tx); + transactionData.txid = txid; + transactionData.tx = tx; callback(null, tx); }); }, function (callback) { - var tx = self.transactionDetailedCache.get(txid); + var tx = transactionData.tx; + var txid = transactionData.txid; var vins = tx.inputs; var functionsArray = []; for (let index = 0; index < vins.length; index++) { @@ -2252,7 +2257,7 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { var rewardData = { tiptime: tx.blockTimestamp || self.tipTime, locktime: result.locktime, - height: result.height ? result.height : 1000001,//To satisfy getKomodoRewards constraints on unconfirmed transactions + height: result.height ? result.height : 1000001, //To satisfy getKomodoRewards constraints on unconfirmed transactions satoshis: vins[index].satoshis, }; rewards = getKomodoRewards(rewardData); @@ -2298,17 +2303,14 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) { tx.rewardClaimed = totalReward; tx.feeSatoshis = tx.inputSatoshis + tx.rewardClaimed * 1e8 - tx.outputSatoshis; - self.transactionDetailedCache.set(txid, tx); + transactionData.txid = txid; + transactionData.tx = tx; callback(null, tx); }); - - // self.transactionDetailedCache.set(txid, tx); - // callback(null, tx); }, ], function (err, results) { - var tx = self.transactionDetailedCache.get(txid); - + var tx = transactionData.tx; done(null, tx); } );