Post
Topic
Board Development & Technical Discussion
Re: Bogus locator in getheaders
by
Coinr8d
on 17/07/2018, 13:49:00 UTC
Small correction.

The limit of what a node replies to a GETHEADERS message can be found here - in net_processing.cpp:

Code:
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
        std::vector vHeaders;
        int nLimit = MAX_HEADERS_RESULTS;
        LogPrint(BCLog::NET, "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), pfrom->GetId());
        for (; pindex; pindex = chainActive.Next(pindex))
        {
            vHeaders.push_back(pindex->GetBlockHeader());
            if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
                break;
        }

You can request as much as you want, you will not get back more than MAX_HEADERS_RESULTS nor will the node process more than that.

But this code is executed AFTER FindForkInGlobalIndex is called. I'm talking about FindForkInGlobalIndex itself.