mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-03 16:02:34 +02:00
RPC/blockchain: gettxout: Move "confirmations" to "confirmations_assumed" when assumeutxo is applicable
This commit is contained in:
parent
d4d90dfcd8
commit
9d12661cfc
@ -1081,6 +1081,7 @@ static RPCHelpMan gettxout()
|
||||
RPCResult{"Otherwise", RPCResult::Type::OBJ, "", "", {
|
||||
{RPCResult::Type::STR_HEX, "bestblock", "The hash of the block at the tip of the chain"},
|
||||
{RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
|
||||
{RPCResult::Type::NUM, "confirmations_assumed", /*optional=*/true, "The number of unverified confirmations (eg, in an assumed-valid UTXO set)"},
|
||||
{RPCResult::Type::STR_AMOUNT, "value", "The transaction value in " + CURRENCY_UNIT},
|
||||
{RPCResult::Type::OBJ, "scriptPubKey", "", {
|
||||
{RPCResult::Type::STR, "asm", "Disassembly of the output script"},
|
||||
@ -1136,7 +1137,13 @@ static RPCHelpMan gettxout()
|
||||
if (coin.nHeight == MEMPOOL_HEIGHT) {
|
||||
ret.pushKV("confirmations", 0);
|
||||
} else {
|
||||
const auto assumed_base_height = chainman.GetSnapshotBaseHeight();
|
||||
if (assumed_base_height && coin.nHeight < *assumed_base_height) {
|
||||
ret.pushKV("confirmations", 0);
|
||||
ret.pushKV("confirmations_assumed", (int64_t)(pindex->nHeight - coin.nHeight + 1));
|
||||
} else {
|
||||
ret.pushKV("confirmations", (int64_t)(pindex->nHeight - coin.nHeight + 1));
|
||||
}
|
||||
}
|
||||
ret.pushKV("value", ValueFromAmount(coin.out.nValue));
|
||||
UniValue o(UniValue::VOBJ);
|
||||
|
Loading…
Reference in New Issue
Block a user