diff --git a/src/main.cpp b/src/main.cpp index 4e1d816dd..cbcaa83c2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4132,7 +4132,13 @@ std::pair, std::optional> TakeRecentlyConflict { AssertLockHeld(cs_main); - std::list conflictedTxs = recentlyConflictedTxs.at(pindex); + // We use bracket notation for retrieving conflict data from recentlyConflictedTxs + // here because when a node restarts, the wallet may be behind the node's view of + // the current chain tip. The node may continue reindexing from the chain tip, but + // no entries will exist in `recentlyConflictedTxs` until the next block after the + // node's chain tip at the point of shutdown. In these cases, the wallet cannot learn + // about conflicts in those blocks (which should be fine). + std::list conflictedTxs = recentlyConflictedTxs[pindex]; recentlyConflictedTxs.erase(pindex); if (recentlyConflictedTxs.empty()) { return std::make_pair(conflictedTxs, nConnectedSequence);