Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain locator maximum size limit differs from Bitcoin Core #1033

Open
pinheadmz opened this issue Aug 23, 2021 · 2 comments
Open

Chain locator maximum size limit differs from Bitcoin Core #1033

pinheadmz opened this issue Aug 23, 2021 · 2 comments

Comments

@pinheadmz
Copy link
Member

From what I can tell, bcoin refuses to accept chain locators with more than 50000 hashes:

Class GetBlocksPacket ... fromReader()...:

assert(count <= common.MAX_INV, 'Too many block hashes.');

net/common.js:

exports.MAX_INV = 50000;

However, Bitcoin Core has a separate value for this limit and it is much, much smaller (101):

https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp#L71-L72

/** The maximum number of entries in a locator */
static const unsigned int MAX_LOCATOR_SZ = 101;

... violations of this limit result in peer disconnection:
https://github.com/bitcoin/bitcoin/blob/dbcb5742c48fd26f77e500291d7083e12eec741b/src/net_processing.cpp#L3006-L3010

        if (locator.vHave.size() > MAX_LOCATOR_SZ) {
            LogPrint(BCLog::NET, "getblocks locator size %lld > %d, disconnect peer=%d\n", locator.vHave.size(), MAX_LOCATOR_SZ, pfrom.GetId());
            pfrom.fDisconnect = true;
            return;
        }

LUCKILY right now even with almost 700,000 blocks in the chain, locators are only about 30 hashes. So this not urgent.

@bcoin-org bcoin-org deleted a comment from G-suite69 Sep 27, 2021
@manavdesai27
Copy link
Contributor

Do we need this limit to be decreased from 50,000 to 101?

@7suyash7
Copy link

7suyash7 commented Feb 1, 2023

@pinheadmz Can I pick this up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants