aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-08-25 16:52:25 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-08-25 16:53:21 +0200
commit776fa60c4bebb809dfadd9859cc2789769d492b9 (patch)
tree661ea64b1d10ca8b09d3b5d1253467df807c1a84 /src/wallet/rpcwallet.cpp
parent55c18a45305f9e89a726f8cf82a7b16a2ab7f955 (diff)
parent23f434378153cf764230066662f3ec3ad614ff30 (diff)
downloadbitcoin-776fa60c4bebb809dfadd9859cc2789769d492b9.tar.xz
Merge #13631: Add CMerkleTx::IsImmatureCoinBase method
23f434378153cf764230066662f3ec3ad614ff30 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
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 81b40aebb7..3d873381e9 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;