diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -80,10 +80,6 @@ //! included in the current chain. virtual Optional getBlockHeight(const BlockHash &hash) = 0; - //! Get block depth. Returns 1 for chain tip, 2 for preceding block, and - //! so on. Returns 0 for a block not included in the current chain. - virtual int getBlockDepth(const BlockHash &hash) = 0; - //! Get block hash. Height must be valid or this function will abort. virtual BlockHash getBlockHash(int height) = 0; diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -52,11 +52,6 @@ } return nullopt; } - int getBlockDepth(const BlockHash &hash) override { - const Optional tip_height = getHeight(); - const Optional height = getBlockHeight(hash); - return tip_height && height ? *tip_height - *height + 1 : 0; - } BlockHash getBlockHash(int height) override { LockAssertion lock(::cs_main); CBlockIndex *block = ::ChainActive()[height]; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1059,7 +1059,8 @@ auto locked_chain = chain().lock(); LOCK(cs_wallet); - int conflictconfirms = -locked_chain->getBlockDepth(hashBlock); + int conflictconfirms = + (m_last_block_processed_height - conflicting_height + 1) * -1; // If number of conflict confirms cannot be determined, this means that the // block is still unknown or not yet part of the main chain, for example