|
|
|
@ -2383,6 +2383,24 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// If we're in IBD, we want outbound peers that will serve us a useful
|
|
|
|
|
// chain. Disconnect peers that are on chains with insufficient work.
|
|
|
|
|
if (IsInitialBlockDownload() && nCount != MAX_HEADERS_RESULTS) {
|
|
|
|
|
// When nCount < MAX_HEADERS_RESULTS, we know we have no more
|
|
|
|
|
// headers to fetch from this peer.
|
|
|
|
|
if (nodestate->pindexBestKnownBlock && nodestate->pindexBestKnownBlock->nChainWork < nMinimumChainWork) {
|
|
|
|
|
// This peer has too little work on their headers chain to help
|
|
|
|
|
// us sync -- disconnect if using an outbound slot (unless
|
|
|
|
|
// whitelisted or addnode).
|
|
|
|
|
// Note: We compare their tip to nMinimumChainWork (rather than
|
|
|
|
|
// chainActive.Tip()) because we won't start block download
|
|
|
|
|
// until we have a headers chain that has at least
|
|
|
|
|
// nMinimumChainWork, even if a peer has a chain past our tip,
|
|
|
|
|
if (!(pfrom->fInbound || pfrom->fWhitelisted || pfrom->m_manual_connection)) {
|
|
|
|
|
pfrom->fDisconnect = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|