HomePhabricator

rpc: getblockfrompeer

Description

rpc: getblockfrompeer

Summary:
This adds an RPC method to fetch a block directly from a peer. This can used to fetch stale blocks with lower proof of work that are normally ignored by the node (headers-only in getchaintips).

Limitations:

  • you have to specify which peer to fetch the block from
  • the node must already have the header

Co-authored-by: John Newbery <john@johnnewbery.com>

This is a backport of core#20295, core#23702 and core#23706 (partial)
https://github.com/bitcoin/bitcoin/pull/20295/commits/dce8c4c38111556ca480aa0e63c46b71f66b508f
https://github.com/bitcoin/bitcoin/pull/23702/commits/aaaa34e34db6ff0f9ca3407bda42e7f0db887737
https://github.com/bitcoin/bitcoin/pull/23706/commits/bfbf91d0b2004dde358253ac174982f784b43b59
https://github.com/bitcoin/bitcoin/pull/23706/commits/809d66bb65aa78048e27c2a878d6f7becaecfe11
https://github.com/bitcoin/bitcoin/pull/23706/commits/0e3d7c5ee16d5a4c061ab9a57285bceb7899b512

The main commit is the first one. The other commits are minor style & comments improvements, and one commit removing an unnecessary argument in the newly added FetchBlock function.

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12716

Details

Provenance
Sjors Provoost <sjors@sprovoost.nl>Authored on May 13 2021, 16:51
PiRKCommitted on Dec 3 2022, 07:51
PiRKPushed on Dec 3 2022, 07:51
Reviewer
Restricted Project
Differential Revision
D12716: rpc: getblockfrompeer
Parents
rABC5a9d6ae343d0: test: use MiniWallet for rpc_scantxoutset.py
Branches
Unknown
Tags
Unknown

Event Timeline