Page MenuHomePhabricator

[net processing] Only send a getheaders for one block in an INV

Authored by PiRK on Jan 29 2021, 17:37.



Headers-first is the primary method of announcement on the network. If a
node fell back sending blocks by inv, it's probably for a re-org. The
final block hash provided should be the highest, so send a getheaders
and then fetch the blocks we need to catch up.

This is a backport of Core PR18962

Test Plan

ninja all check-all

Diff Detail

rABC Bitcoin ABC
Lint Not Applicable
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jan 29 2021, 17:37
Fabien requested changes to this revision.Jan 29 2021, 19:31
Fabien added a subscriber: Fabien.
Fabien added inline comments.
3025 ↗(On Diff #27430)

This should be a BlockHash

This revision now requires changes to proceed.Jan 29 2021, 19:31
3025 ↗(On Diff #27430)

I tried this, but I did it wrong and the linter started yelling at me because I used a pointer to a local variable (hash) out of its scope. Also it requires removing the constness from hash.
Marco suggested a solution with a std::optional<BlockHash>.

use a std::optional<BlockHash> and std::move

This revision is now accepted and ready to land.Feb 1 2021, 08:34