Fix confirmations value in gettx api

This commit is contained in:
Joe Uhren
2023-03-03 15:20:33 -07:00
parent 4047587990
commit 208187c293
+3 -3
View File
@@ -188,7 +188,7 @@ app.use('/ext/gettx/:txid', function(req, res) {
db.get_tx(txid, function(tx) {
if (tx) {
lib.get_blockcount(function(blockcount) {
res.send({ active: 'tx', tx: tx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0)});
res.send({ active: 'tx', tx: tx, confirmations: (blockcount - tx.blockindex + 1), blockcount: (blockcount ? blockcount : 0)});
});
} else {
lib.get_rawtransaction(txid, function(rtx) {
@@ -207,7 +207,7 @@ app.use('/ext/gettx/:txid', function(req, res) {
blockindex: -1
};
res.send({ active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount:-1});
res.send({ active: 'tx', tx: utx, confirmations: rtx.confirmations, blockcount:-1});
} else {
var utx = {
txid: rtx.txid,
@@ -220,7 +220,7 @@ app.use('/ext/gettx/:txid', function(req, res) {
};
lib.get_blockcount(function(blockcount) {
res.send({ active: 'tx', tx: utx, confirmations: settings.shared_pages.confirmations, blockcount: (blockcount ? blockcount : 0)});
res.send({ active: 'tx', tx: utx, confirmations: rtx.confirmations, blockcount: (blockcount ? blockcount : 0)});
});
}
});