Unverified Commit f5ff022d authored by Felipe Strozberg's avatar Felipe Strozberg Committed by GitHub

ethclient: add PeerCount method (#24849)

* adding peer count function

* Update ethclient.go
Co-authored-by: 's avatarFelix Lange <fjl@twurst.com>
parent 539bbd63
......@@ -94,6 +94,13 @@ func (ec *Client) BlockNumber(ctx context.Context) (uint64, error) {
return uint64(result), err
}
// PeerCount returns the number of p2p peers as reported by the net_peerCount method.
func (ec *Client) PeerCount(ctx context.Context) (uint64, error) {
var result hexutil.Uint64
err := ec.c.CallContext(ctx, &result, "net_peerCount")
return uint64(result), err
}
type rpcBlock struct {
Hash common.Hash `json:"hash"`
Transactions []rpcTransaction `json:"transactions"`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment