core, eth: split eth package, implement snap protocol (#21482)
This commit splits the eth package, separating the handling of eth and snap protocols. It also includes the capability to run snap sync (https://github.com/ethereum/devp2p/blob/master/caps/snap.md) , but does not enable it by default. Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de> Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
13
les/peer.go
13
les/peer.go
@ -31,7 +31,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/forkid"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
"github.com/ethereum/go-ethereum/les/flowcontrol"
|
||||
lpc "github.com/ethereum/go-ethereum/les/lespay/client"
|
||||
lps "github.com/ethereum/go-ethereum/les/lespay/server"
|
||||
@ -162,9 +161,17 @@ func (p *peerCommons) String() string {
|
||||
return fmt.Sprintf("Peer %s [%s]", p.id, fmt.Sprintf("les/%d", p.version))
|
||||
}
|
||||
|
||||
// PeerInfo represents a short summary of the `eth` sub-protocol metadata known
|
||||
// about a connected peer.
|
||||
type PeerInfo struct {
|
||||
Version int `json:"version"` // Ethereum protocol version negotiated
|
||||
Difficulty *big.Int `json:"difficulty"` // Total difficulty of the peer's blockchain
|
||||
Head string `json:"head"` // SHA3 hash of the peer's best owned block
|
||||
}
|
||||
|
||||
// Info gathers and returns a collection of metadata known about a peer.
|
||||
func (p *peerCommons) Info() *eth.PeerInfo {
|
||||
return ð.PeerInfo{
|
||||
func (p *peerCommons) Info() *PeerInfo {
|
||||
return &PeerInfo{
|
||||
Version: p.version,
|
||||
Difficulty: p.Td(),
|
||||
Head: fmt.Sprintf("%x", p.Head()),
|
||||
|
Reference in New Issue
Block a user