mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge #13631: Add CMerkleTx::IsImmatureCoinBase method
23f4343781 Add CMerkleTx::IsImmatureCoinBase method (Ben Woosley)
Pull request description:
All but one call to `GetBlocksToMaturity` is testing it relative to 0
for the purposes of determining whether the coinbase tx is immature.
In such case, the value greater than 0 implies that the tx is coinbase,
so there is no need to separately test that status.
This names the concept for easy singular use.
Tree-SHA512: 4470d07404a0707144f9827b9a94c5c4905f23ee6f9248edc5df599a59d28e21ea0201d8abe5d5d73b39cb05b60c861ea8e04767eef04433e2ee95dcfed653ee
This commit is contained in:
@@ -1851,7 +1851,7 @@ static void ListTransactions(CWallet* const pwallet, const CWalletTx& wtx, const
|
||||
{
|
||||
if (wtx.GetDepthInMainChain() < 1)
|
||||
entry.pushKV("category", "orphan");
|
||||
else if (wtx.GetBlocksToMaturity() > 0)
|
||||
else if (wtx.IsImmatureCoinBase())
|
||||
entry.pushKV("category", "immature");
|
||||
else
|
||||
entry.pushKV("category", "generate");
|
||||
@@ -2147,7 +2147,7 @@ static UniValue listaccounts(const JSONRPCRequest& request)
|
||||
std::list<COutputEntry> listReceived;
|
||||
std::list<COutputEntry> listSent;
|
||||
int nDepth = wtx.GetDepthInMainChain();
|
||||
if (wtx.GetBlocksToMaturity() > 0 || nDepth < 0)
|
||||
if (wtx.IsImmatureCoinBase() || nDepth < 0)
|
||||
continue;
|
||||
wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount, includeWatchonly);
|
||||
mapAccountBalances[strSentAccount] -= nFee;
|
||||
|
||||
Reference in New Issue
Block a user