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

pull optout21 wants to merge 6 commits into bitcoin:master from optout21:block-dl changing 8 files +330 −10
  1. optout21 commented at 9:01 AM on April 19, 2026: contributor

    Revival of closed/stale #27837, authored by @furszy . The change is taken (as of b18c72cfcd6f27070928bc0ba16db6897960f211) and rebased to current master. Original description follows.

    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.

  2. net: FetchBlock, disallow requesting blocks from network limited peers
    This is in preparation for block tracker.
    
    Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
    5d3852f01c
  3. net: FetchBlock, disallow requesting block to the same peer multiple times
    Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
    20b842729f
  4. net: introduce BlockRequestTracker
    Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
    691cb0426a
  5. rpc: getblockfrompeer, connect block tracking mechanism and add coverage
    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.
    
    Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
    2cedb97b93
  6. rpc: getblockfrompeer, introduce fetch from "any" peer functionality
    If no 'peer_id' is provided, 'getblockfrompeer' will delegate
    the peer selection to the internal block downloading logic.
    
    Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
    e7d0aac60a
  7. rpc: getblockfrompeer, add one-shot block requests capability
    Allowing what we had before, a single block request with no automatic
    retry nor tracking mechanism.
    
    Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
    d3951af263
  8. DrahtBot added the label P2P on Apr 19, 2026
  9. DrahtBot commented at 9:01 AM on April 19, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me