diff --git a/src/main.cpp b/src/main.cpp index 3f79c13eb..5dc93c611 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6890,7 +6890,15 @@ void static ProcessGetData(CNode* pfrom) CBlock block; if (!ReadBlockFromDisk(block, (*mi).second,1)) { - assert(!"cannot load block from disk"); + // A block we advertised (BLOCK_HAVE_DATA) failed to load from disk: a transient + // I/O error or on-disk corruption. This previously asserted and crashed the whole + // node -- any peer getdata for such a block could take us down. Log and drop this + // peer instead; it can re-fetch from another node. (The bulk GETBLOCKSTREAM serve + // path already fails gracefully rather than asserting.) + LogPrintf("%s: ReadBlockFromDisk failed for block %s (peer=%i);" + " disconnecting peer instead of asserting\n", + __func__, inv.hash.ToString(), pfrom->GetId()); + pfrom->fDisconnect = true; } else {