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

net: introduce block tracker to retry to download blocks after failure #27837

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

furszy
Copy link
Member

@furszy furszy commented Jun 7, 2023

Coming from #27652, part of #29183.

The general idea is to keep track of the user requested blocks so, in
case of a bad behaving peer or a network disconnection, they can be
fetched from another one automatically without any further user interaction.

This was requested by users because the getblockfrompeer RPC command
lacks the functionality to notify them about block request failures or peer
disconnections (which is expected due to the asynchronous nature of the block
requests).

Currently, this new functionality is limited to blocks requested by the
user via the 'getblockfrompeer' RPC command.

In the future, this class could expand its scope and be utilized in the
regular chain synchronization process. Or, even could be employed in
special procedures like a prune node rescan that uses BIP158 block filters,
or even into BIP157 itself.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 7, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28488 (p2p: Evict outbound peers with high minFeeRate by naumenkogs)
  • #28055 (Bugfix: net_processing: Restore "Already requested" error for FetchBlock by luke-jr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@maflcko
Copy link
Member

maflcko commented Jun 13, 2023

Maybe mark as draft if CI is red and this is still based on something else?

@fanquake fanquake marked this pull request as draft June 13, 2023 08:27
@furszy
Copy link
Member Author

furszy commented Jun 13, 2023

Oh, didn't know about the CI failure. Seems to be just an unused variable. But sure, draft until #27836 sounds good.

@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from 1311875 to aab7a2f Compare August 1, 2023 21:27
@DrahtBot DrahtBot removed the CI failed label Aug 1, 2023
@DrahtBot DrahtBot mentioned this pull request Aug 24, 2023
Copy link
Member Author

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focus is on #28170, which is quite close.
Will rebase it as soon as it is merged.

@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from 4d65b99 to 7eb78f3 Compare March 11, 2024 12:56
@furszy furszy marked this pull request as ready for review March 11, 2024 12:57
@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from 7eb78f3 to 77fff41 Compare March 11, 2024 13:06
@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/22512552586

@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from 77fff41 to ab0d925 Compare March 12, 2024 14:03
@DrahtBot
Copy link
Contributor

Could turn into a draft while CI is red?

@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from ab0d925 to ad4fc1b Compare April 18, 2024 12:21
@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from ad4fc1b to 3c7fd2c Compare April 29, 2024 13:06
furszy added 6 commits May 1, 2024 11:19
If the initial block fetching process fails, the p2p layer will be in
charge of fetching the block from 'any' connected peer.
Re-trying to download the block from different peers until it is
received.
If no 'peer_id' is provided, 'getblockfrompeer' will just delegate
the peer selection to the internal block downloading logic.
Allowing what we had before, a single block request with no automatic
retry nor tracking mechanism.
@furszy furszy force-pushed the 2023_introduce_block_request_tracker branch from 3c7fd2c to fdab5b8 Compare May 1, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants