This PR implements a new RPC/IPC call named debug.peerStats which can be used to get additional block related information from all the connected peers.
More specifically, it emits hash, number and td (total difficulty) of the head block of all the peers along with some metadata and identifiers. Note that the number field is derived locally and isn't maintained in the peer's struct. It may be a non-zero block number if we have the hash locally else 0.
Description
This PR implements a new RPC/IPC call named
debug.peerStats
which can be used to get additional block related information from all the connected peers.More specifically, it emits
hash
,number
andtd
(total difficulty) of the head block of all the peers along with some metadata and identifiers. Note that thenumber
field is derived locally and isn't maintained in the peer's struct. It may be a non-zero block number if we have the hash locally else 0.Example: IPC
RPC:
curl http://localhost:8545 -X POST --data '{"jsonrpc":"2.0","method":"debug_peerStats","params":[],"id":1}' -H "Content-Type: application/json" | jq
Changes
Checklist
Cross repository changes
Testing
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it