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/wallet.h | |
parent | 29b4ee64695f79511912ae127e66e0fe82f7a0d1 (diff) |
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/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 2ada233514..8253dc1eba 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -266,6 +266,12 @@ public: */ int GetDepthInMainChain() const; bool IsInMainChain() const { return GetDepthInMainChain() > 0; } + + /** + * @return number of blocks to maturity for this transaction: + * 0 : is not a coinbase transaction, or is a mature coinbase transaction + * >0 : is a coinbase transaction which matures in this many blocks + */ int GetBlocksToMaturity() const; bool hashUnset() const { return (hashBlock.IsNull() || hashBlock == ABANDON_HASH); } bool isAbandoned() const { return (hashBlock == ABANDON_HASH); } @@ -273,6 +279,7 @@ public: const uint256& GetHash() const { return tx->GetHash(); } bool IsCoinBase() const { return tx->IsCoinBase(); } + bool IsImmatureCoinBase() const; }; //Get the marginal bytes of spending the specified output |