Skip to content

Commit 0e24bbf

Browse files
committed
Self check after the last peer is removed
1 parent 2d1d658 commit 0e24bbf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,13 @@ void FinalizeNode(NodeId nodeid) {
338338
assert(nPeersWithValidatedDownloads >= 0);
339339

340340
mapNodeState.erase(nodeid);
341+
342+
if (mapNodeState.empty()) {
343+
// Do a consistency check after the last peer is removed.
344+
assert(mapBlocksInFlight.empty());
345+
assert(nPreferredDownload == 0);
346+
assert(nPeersWithValidatedDownloads == 0);
347+
}
341348
}
342349

343350
// Requires cs_main.

0 commit comments

Comments
 (0)