p2p, doc: Use MAX_BLOCKS_TO_ANNOUNCE consistently
It is an inclusive upper bound according to its definition.
This commit is contained in:
1 parent
7f2c983e1c
commit
e357c89538
1 file changed
+3
-3
@@ -2208,7 +2208,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
|
|||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
CNodeState *nodestate = State(pfrom.GetId());
|
CNodeState *nodestate = State(pfrom.GetId());
|
||||||
|
|
||||||
// If this looks like it could be a block announcement (nCount <
|
// If this looks like it could be a block announcement (nCount <=
|
||||||
// MAX_BLOCKS_TO_ANNOUNCE), use special logic for handling headers that
|
// MAX_BLOCKS_TO_ANNOUNCE), use special logic for handling headers that
|
||||||
// don't connect:
|
// don't connect:
|
||||||
// - Send a getheaders message in response to try to connect the chain.
|
// - Send a getheaders message in response to try to connect the chain.
|
||||||
@@ -2216,7 +2216,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
|
|||||||
// don't connect before giving DoS points
|
// don't connect before giving DoS points
|
||||||
// - Once a headers message is received that is valid and does connect,
|
// - Once a headers message is received that is valid and does connect,
|
||||||
// nUnconnectingHeaders gets reset back to 0.
|
// nUnconnectingHeaders gets reset back to 0.
|
||||||
if (!m_chainman.m_blockman.LookupBlockIndex(headers[0].hashPrevBlock) && nCount < MAX_BLOCKS_TO_ANNOUNCE) {
|
if (!m_chainman.m_blockman.LookupBlockIndex(headers[0].hashPrevBlock) && nCount <= MAX_BLOCKS_TO_ANNOUNCE) {
|
||||||
nodestate->nUnconnectingHeaders++;
|
nodestate->nUnconnectingHeaders++;
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, m_chainman.ActiveChain().GetLocator(m_chainman.m_best_header), uint256()));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, m_chainman.ActiveChain().GetLocator(m_chainman.m_best_header), uint256()));
|
||||||
LogPrint(BCLog::NET, "received header %s: missing prev block %s, sending getheaders (%d) to end (peer=%d, nUnconnectingHeaders=%d)\n",
|
LogPrint(BCLog::NET, "received header %s: missing prev block %s, sending getheaders (%d) to end (peer=%d, nUnconnectingHeaders=%d)\n",
|
||||||
@@ -4772,7 +4772,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
|||||||
// Try sending block announcements via headers
|
// Try sending block announcements via headers
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
// If we have less than MAX_BLOCKS_TO_ANNOUNCE in our
|
// If we have no more than MAX_BLOCKS_TO_ANNOUNCE in our
|
||||||
// list of block hashes we're relaying, and our peer wants
|
// list of block hashes we're relaying, and our peer wants
|
||||||
// headers announcements, then find the first header
|
// headers announcements, then find the first header
|
||||||
// not yet known to our peer but would connect, and send.
|
// not yet known to our peer but would connect, and send.
|
||||||
|
|||||||
Reference in new issue
Block a user