diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2018-07-11 01:17:59 -0400 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2018-07-29 19:49:14 -0400 |
commit | 23f434378153cf764230066662f3ec3ad614ff30 (patch) | |
tree | cc049ebe24f4323b63c040618485280f9108700d /src/wallet/rpcwallet.cpp | |
parent | 29b4ee64695f79511912ae127e66e0fe82f7a0d1 (diff) | |
download | bitcoin-23f434378153cf764230066662f3ec3ad614ff30.tar.xz |
Add CMerkleTx::IsImmatureCoinBase method
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.
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 73dfebf114..84fd55edef 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -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; |