Skip to content

Commit 46f0e30

Browse files
committed
Fixing reindex problem, use mapBlockIndex.find() and not mapBlockIndex[]
1 parent da78039 commit 46f0e30

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,8 @@ bool CWallet::LoadToWallet(CWalletTx& wtxIn)
977977
// If tx hasn't been reorged out of chain while wallet being shutdown
978978
// change tx status to UNCONFIRMED and reset hashBlock/nIndex.
979979
if (!wtxIn.m_confirm.hashBlock.IsNull()) {
980-
CBlockIndex* pindex = mapBlockIndex[wtxIn.m_confirm.hashBlock];
980+
auto it = mapBlockIndex.find(wtxIn.m_confirm.hashBlock);
981+
CBlockIndex* pindex = it == mapBlockIndex.end() ? nullptr : it->second;
981982
if (!pindex || !chainActive.Contains(pindex)) {
982983
wtxIn.setUnconfirmed();
983984
wtxIn.m_confirm.hashBlock = UINT256_ZERO;

0 commit comments

Comments
 (0)