Skip to content

Commit

Permalink
fix for tx confirmations when cache enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pointbiz committed Jun 6, 2021
1 parent 60a4cb5 commit fdf3378
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion routes/baseRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1258,13 +1258,22 @@ router.get("/tx/:transactionId", asyncHandler(async (req, res, next) => {

res.locals.result.getblock = blockHeader;

resolve();
resolve(blockHeader);

} catch (err) {
utils.logError("239rge0uwhse", err);

resolve();
}
}).then(function(blockHeader) {
// fix confirmations for cached transactions
if (!config.noInmemoryRpcCache && blockHeader && blockHeader.height) {
rpcApi.getBlockCount().then(function(blockcount){
var confs = blockcount - blockHeader.height + 1;
res.locals.tx.confirmations = confs;
res.locals.result.getrawtransaction.confirmations = confs;
});
}
}));
}

Expand Down

0 comments on commit fdf3378

Please sign in to comment.