The node is very efficient at not downloading blocks it doesn’t care about. E.g. if a peer has headers for a lower proof-of-work branch, we won’t fetch the full block. It’ll appear as headers-only
or valid-headers
in getchaintips
.
This is fine, but if a user is curious about a block, there’s no easy way to obtain it.
- you can call
invalidateblock
on the current tip and wait for the node to jump to the other branch - you can use some other software to obtain the block via p2p and then feed it to the node with
submitblock
It would be nice if you can just fetch it from a peer, if you know they have it. In the most simple implementation, the user has to specify which node to ask. A more fancy version could automatically try all nodes, and perhaps even randomly connect to new peers until it finds the block.
Usage:
0bitcoin-cli getblockfrompeer HASH peer_n