Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
This is in preparation for block tracker. Co-authored-by: optout <[email protected]>
…times Co-authored-by: optout <[email protected]>
Co-authored-by: optout <[email protected]>
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: optout <[email protected]>
If no 'peer_id' is provided, 'getblockfrompeer' will delegate the peer selection to the internal block downloading logic. Co-authored-by: optout <[email protected]>
Allowing what we had before, a single block request with no automatic retry nor tracking mechanism. Co-authored-by: optout <[email protected]>
| {"peer_id", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The peer to fetch it from (see getpeerinfo for peer IDs). " | ||
| "If omitted, the node will fetch the block from any available peer."}, | ||
| {"retry", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED, "Whether to automatically retry to download the block from different peers if the initial request fails or not. " | ||
| "If omitted, the node will continuously attempt to download the block from various peers until it succeeds."}, |
There was a problem hiding this comment.
Sounds like that's a default of true (not RPCArg::Optional::OMITTED with a description noting it)?
| {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash to try to fetch"}, | ||
| {"peer_id", RPCArg::Type::NUM, RPCArg::Optional::NO, "The peer to fetch it from (see getpeerinfo for peer IDs)"}, | ||
| {"peer_id", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The peer to fetch it from (see getpeerinfo for peer IDs). " | ||
| "If omitted, the node will fetch the block from any available peer."}, |
There was a problem hiding this comment.
| "If omitted, the node will fetch the block from any available peer."}, | |
| "If omitted, the node will fetch the block from any available peer. (requires retry=true)"}, |
...or fix it to work without retry
| {"peer_id", RPCArg::Type::NUM, RPCArg::Optional::NO, "The peer to fetch it from (see getpeerinfo for peer IDs)"}, | ||
| {"peer_id", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The peer to fetch it from (see getpeerinfo for peer IDs). " | ||
| "If omitted, the node will fetch the block from any available peer."}, | ||
| {"retry", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED, "Whether to automatically retry to download the block from different peers if the initial request fails or not. " |
There was a problem hiding this comment.
Booleans should ideally not be positional parameters, named only (eg, with an options Object)
optout21
left a comment
There was a problem hiding this comment.
The last commit re-introduces behavior "what we had before". I will see how changes could be reordered to avoid removing some behavior and then re-introducing again.
|
@luke-jr , thanks for the comments on the RPC parameters, I will consider them with upcoming changes. |
|
🐙 This pull request conflicts with the target branch and needs rebase. |
|
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
|
Closing for now, due to lack of focus, limited personal resources. Could be marked "Up for grabs"! |

Revival of closed/stale #27837 . The change is taken (as of b18c72c) 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
getblockfrompeerRPC commandlacks 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.