diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-08-25 16:52:25 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-08-25 16:53:21 +0200 |
commit | 776fa60c4bebb809dfadd9859cc2789769d492b9 (patch) | |
tree | 661ea64b1d10ca8b09d3b5d1253467df807c1a84 /src/wallet/wallet.h | |
parent | 55c18a45305f9e89a726f8cf82a7b16a2ab7f955 (diff) | |
parent | 23f434378153cf764230066662f3ec3ad614ff30 (diff) | |
download | bitcoin-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/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 57b22c0e49..c085c004b7 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 |