From 0e24bbf679c95784ed5514a6a1f2fbf99dd97725 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 4 Apr 2016 13:35:26 +0200 Subject: Self check after the last peer is removed --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index de74593bb1..87c727b28f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -338,6 +338,13 @@ void FinalizeNode(NodeId nodeid) { assert(nPeersWithValidatedDownloads >= 0); mapNodeState.erase(nodeid); + + if (mapNodeState.empty()) { + // Do a consistency check after the last peer is removed. + assert(mapBlocksInFlight.empty()); + assert(nPreferredDownload == 0); + assert(nPeersWithValidatedDownloads == 0); + } } // Requires cs_main. -- cgit v1.2.3