diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cdba6c644..81e65b044 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4397,7 +4397,9 @@ int CMerkleTx::GetBlocksToMaturity() const { if (!IsCoinBase()) return 0; - return std::max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain()); + int chain_depth = GetDepthInMainChain(); + assert(chain_depth >= 0); // coinbase tx should not be conflicted + return std::max(0, (COINBASE_MATURITY+1) - chain_depth); }