File tree Expand file tree Collapse file tree 2 files changed +16
-19
lines changed
Expand file tree Collapse file tree 2 files changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -3833,30 +3833,28 @@ int CMerkleTx::SetMerkleBranch(const CBlock& block)
38333833 return chainActive.Height () - pindex->nHeight + 1 ;
38343834}
38353835
3836- int CMerkleTx::GetDepthInMainChainINTERNAL (const CBlockIndex*& pindexRet) const
3836+ int CMerkleTx::GetDepthInMainChain (const CBlockIndex*& pindexRet, bool enableIX ) const
38373837{
38383838 if (hashUnset ())
38393839 return 0 ;
38403840 AssertLockHeld (cs_main);
3841+ int nResult;
38413842
38423843 // Find the block it claims to be in
38433844 BlockMap::iterator mi = mapBlockIndex.find (hashBlock);
3844- if (mi == mapBlockIndex.end ())
3845- return 0 ;
3846- CBlockIndex* pindex = (*mi).second ;
3847- if (!pindex || !chainActive.Contains (pindex))
3848- return 0 ;
3849-
3850- pindexRet = pindex;
3851- return ((nIndex == -1 ) ? (-1 ) : 1 ) * (chainActive.Height () - pindex->nHeight + 1 );
3852- }
3853-
3854- int CMerkleTx::GetDepthInMainChain (const CBlockIndex*& pindexRet, bool enableIX) const
3855- {
3856- AssertLockHeld (cs_main);
3857- int nResult = GetDepthInMainChainINTERNAL (pindexRet);
3858- if (nResult == 0 && !mempool.exists (GetHash ()))
3859- return -1 ; // Not in chain, not in mempool
3845+ if (mi == mapBlockIndex.end ()) {
3846+ nResult = 0 ;
3847+ }
3848+ else {
3849+ CBlockIndex* pindex = (*mi).second ;
3850+ if (!pindex || !chainActive.Contains (pindex)) {
3851+ nResult = 0 ;
3852+ }
3853+ else {
3854+ pindexRet = pindex;
3855+ nResult = ((nIndex == -1 ) ? (-1 ) : 1 ) * (chainActive.Height () - pindex->nHeight + 1 );
3856+ }
3857+ }
38603858
38613859 if (enableIX) {
38623860 if (nResult < 6 ) {
Original file line number Diff line number Diff line change @@ -619,7 +619,6 @@ struct COutputEntry {
619619class CMerkleTx : public CTransaction
620620{
621621private:
622- int GetDepthInMainChainINTERNAL (const CBlockIndex*& pindexRet) const ;
623622 /* * Constant used in hashBlock to indicate tx has been abandoned */
624623 static const uint256 ABANDON_HASH;
625624
@@ -679,7 +678,7 @@ class CMerkleTx : public CTransaction
679678 bool IsInMainChain () const
680679 {
681680 const CBlockIndex* pindexRet;
682- return GetDepthInMainChainINTERNAL (pindexRet) > 0 ;
681+ return GetDepthInMainChain (pindexRet, false ) > 0 ;
683682 }
684683 int GetBlocksToMaturity () const ;
685684 bool AcceptToMemoryPool (bool fLimitFree = true , bool fRejectInsaneFee = true , bool ignoreFees = false );
You can’t perform that action at this time.
0 commit comments