Added GetHeightInMainChain() method.
Corrected call to GetDepthInMainChain() with GetHeightInMainChain() when checking coin maturity.
This commit is contained in:
parent
e1ce43df71
commit
85392ed8bb
|
@ -932,12 +932,17 @@ int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
|
|||
return nResult;
|
||||
}
|
||||
|
||||
int CMerkleTx::GetHeightInMainChain(CBlockIndex* &pindexRet) const
|
||||
{
|
||||
return chainActive.Height() - GetDepthInMainChain(pindexRet) + 1;
|
||||
}
|
||||
|
||||
int CMerkleTx::GetBlocksToMaturity() const
|
||||
{
|
||||
if (!IsCoinBase())
|
||||
return 0;
|
||||
|
||||
if(GetDepthInMainChain() >= COINBASE_MATURITY_SWITCH)
|
||||
if(GetHeightInMainChain() >= COINBASE_MATURITY_SWITCH)
|
||||
return max(0, (COINBASE_MATURITY_NEW+20) - GetDepthInMainChain());
|
||||
else
|
||||
return max(0, (COINBASE_MATURITY+20) - GetDepthInMainChain());
|
||||
|
|
|
@ -476,6 +476,8 @@ public:
|
|||
// >=1 : this many blocks deep in the main chain
|
||||
int GetDepthInMainChain(CBlockIndex* &pindexRet) const;
|
||||
int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
|
||||
int GetHeightInMainChain(CBlockIndex* &pindexRet) const;
|
||||
int GetHeightInMainChain() const { CBlockIndex *pindexRet; return GetHeightInMainChain(pindexRet); }
|
||||
bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
|
||||
int GetBlocksToMaturity() const;
|
||||
bool AcceptToMemoryPool(bool fLimitFree=true);
|
||||
|
|
Loading…
Reference in a new issue