bcoin
bcoin copied to clipboard
Chain locator maximum size limit differs from Bitcoin Core
From what I can tell, bcoin refuses to accept chain locators with more than 50000 hashes:
Class GetBlocksPacket ... fromReader()...
:
https://github.com/bcoin-org/bcoin/blob/b7280a1d521fba676f578e5186a543c442a51a16/lib/net/packets.js#L1040
net/common.js
:
https://github.com/bcoin-org/bcoin/blob/b7280a1d521fba676f578e5186a543c442a51a16/lib/net/common.js#L203
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.
Do we need this limit to be decreased from 50,000 to 101?
@pinheadmz Can I pick this up?