Skip to content

Downloading headers from peers which are bootstrapping. #6861

@afk11

Description

@afk11

Core will send a getheaders message to every peer it connects to. Should a peer respond with the first 2000 headers, Core will begin to download the headers chain from scratch, despite already having these. This is particularly strange while in parallel, the fresh peer may also be actively downloading blocks from the fully synced node.

This check is what causes it to redownload the chain: https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L4434 I worry about this, since incoming peers can also trigger this - and only have to have the first 2000 headers for it to work.

So I'm wondering if there's a reason or if it's a bug. I thought headers messages started at the next best header in the main chain? Can we simply disregard a headers message that doesn't start with an unknown header?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions