diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2014-10-27 13:40:24 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2014-10-27 13:42:01 -0400 |
commit | 35ece7dd074e1cb1b00ffb89dc6a6de063145b53 (patch) | |
tree | 650e7cc493cbae953e9c3813d08b0f73569dc91b | |
parent | e4f79c0219b6febbaa6cb8858ad9a8904769f735 (diff) | |
parent | a31e8bad53e44629b26e7f36e0431b9fa01c1ed6 (diff) |
Merge pull request #5135
a31e8ba Make CBlockIndex* returned by GetDepthInMainChain const. (Daniel Kraft)
Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>
-rw-r--r-- | src/wallet.cpp | 4 | ||||
-rw-r--r-- | src/wallet.h | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index 65944587f8..3812c22fe2 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -2298,7 +2298,7 @@ int CMerkleTx::SetMerkleBranch(const CBlock& block) return chainActive.Height() - pindex->nHeight + 1; } -int CMerkleTx::GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const +int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const { if (hashBlock == 0 || nIndex == -1) return 0; @@ -2324,7 +2324,7 @@ int CMerkleTx::GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const return chainActive.Height() - pindex->nHeight + 1; } -int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const +int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const { AssertLockHeld(cs_main); int nResult = GetDepthInMainChainINTERNAL(pindexRet); diff --git a/src/wallet.h b/src/wallet.h index 06706655f8..9b6895090c 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -474,7 +474,7 @@ struct COutputEntry class CMerkleTx : public CTransaction { private: - int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const; + int GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const; public: uint256 hashBlock; @@ -519,9 +519,9 @@ public: // -1 : not in blockchain, and not in memory pool (conflicted transaction) // 0 : in memory pool, waiting to be included in a block // >=1 : this many blocks deep in the main chain - int GetDepthInMainChain(CBlockIndex* &pindexRet) const; - int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); } - bool IsInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; } + int GetDepthInMainChain(const CBlockIndex* &pindexRet) const; + int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); } + bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; } int GetBlocksToMaturity() const; bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectInsaneFee=true); }; |