Noticed by @gmaxwell: a node keeps downloading blocks after a local error that caused it to treat one block as invalid.
NOT tested.
After having applied this I've rigged my bitcoind to fail at block 10000, with
diff --git a/src/main.cpp b/src/main.cpp
index 235d3e6..2a9f20b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1960,6 +1961,11 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
CInv inv(MSG_BLOCK, pindexNew->GetBlockHash());
bool rv = ConnectBlock(*pblock, state, pindexNew, view);
g_signals.BlockChecked(*pblock, state);
+ if (chainActive.Height() == 10000)
+ {
+ rv = false;
+ state.Invalid(error("height == 10000"));
+ }
if (!rv) {
if (state.IsInvalid())
InvalidBlockFound(pindexNew, state);
But it keeps downloading: see http://www.hastebin.com/retodasuje.txt for debug.log extract.
Updated, and tested with your patch.
It still tries to connect the same block over and over again, but that's because the validated doesn't actually mark it as invalid.
Tested ACK
ACK
ACK (tested)