HomePhabricator

Introduce a maximum size for locators.

Description

Introduce a maximum size for locators.

Summary:

The largest sensible size for a locator is log in the number of blocks.
But, as noted by Coinr8d on BCT a maximum size message could encode a
hundred thousand locators.  If height were used to limit the messages
that could open new attacks where peers on long low diff forks would get
disconnected and end up stuck.

Ideally, nodes first first learn to limit the size of locators they send
before limiting what would be processed, but common implementations back
off with an exponent of 2 and have an implicit limit of 2^32 blocks, so
they already cannot produce locators over some size.

This sets the limit to an absurdly high amount of 101 in order to
maximize compatibility with existing software.

Backport of core PR13907 and PR13915:
https://github.com/bitcoin/bitcoin/pull/13907/files
https://github.com/bitcoin/bitcoin/pull/13915/files

Test Plan:

ninja check
test_runner.py p2p_invalid_locator

Reviewers: #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D4469

Details

Provenance
Gregory Maxwell <greg@xiph.org>Authored on Aug 7 2018, 20:37
FabienCommitted on Nov 20 2019, 08:48
FabienPushed on Nov 20 2019, 08:48
Reviewer
Restricted Project
Differential Revision
D4469: Introduce a maximum size for locators.
Parents
rABC7bb93a6e92d4: test: Add tests for RPC help
Branches
Unknown
Tags
Unknown