Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib/services/bitcoind.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2162,6 +2164,7 @@ Bitcoin.prototype.getDetailedTransaction = function (txid, callback) {
});
} else {
self._tryAllClients(function (client, done) {
let transactionData = {};
async.series(
[
function (callback) {
Expand Down Expand Up @@ -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++) {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
);
Expand Down