diff options
| author | Ross Nicoll <[email protected]> | 2014-04-20 12:12:03 +0100 |
|---|---|---|
| committer | Patrick Lodder <[email protected]> | 2014-04-20 17:47:11 +0400 |
| commit | 85392ed8bbcb6bd2d199f9f78b8657b719401404 (patch) | |
| tree | ad1e3114de9d646a4d69f8404e8ff5f4309fd564 /src/main.cpp | |
| parent | Corrected block maturity test. (diff) | |
| download | archived-discoin-85392ed8bbcb6bd2d199f9f78b8657b719401404.tar.xz archived-discoin-85392ed8bbcb6bd2d199f9f78b8657b719401404.zip | |
Added GetHeightInMainChain() method.
Corrected call to GetDepthInMainChain() with GetHeightInMainChain() when checking coin maturity.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index dac145148..3210a7875 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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()); |