Skip to content

Commit 064ab70

Browse files
authored
eth/protocols/eth: use BlockChain interface in Handshake (#32847)
1 parent 168d699 commit 064ab70

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

eth/protocols/eth/handshake.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"time"
2323

2424
"github.com/ethereum/go-ethereum/common"
25-
"github.com/ethereum/go-ethereum/core"
2625
"github.com/ethereum/go-ethereum/core/forkid"
2726
"github.com/ethereum/go-ethereum/metrics"
2827
"github.com/ethereum/go-ethereum/p2p"
@@ -36,7 +35,7 @@ const (
3635

3736
// Handshake executes the eth protocol handshake, negotiating version number,
3837
// network IDs, difficulties, head and genesis blocks.
39-
func (p *Peer) Handshake(networkID uint64, chain *core.BlockChain, rangeMsg BlockRangeUpdatePacket) error {
38+
func (p *Peer) Handshake(networkID uint64, chain forkid.Blockchain, rangeMsg BlockRangeUpdatePacket) error {
4039
switch p.version {
4140
case ETH69:
4241
return p.handshake69(networkID, chain, rangeMsg)
@@ -47,10 +46,10 @@ func (p *Peer) Handshake(networkID uint64, chain *core.BlockChain, rangeMsg Bloc
4746
}
4847
}
4948

50-
func (p *Peer) handshake68(networkID uint64, chain *core.BlockChain) error {
49+
func (p *Peer) handshake68(networkID uint64, chain forkid.Blockchain) error {
5150
var (
5251
genesis = chain.Genesis()
53-
latest = chain.CurrentBlock()
52+
latest = chain.CurrentHeader()
5453
forkID = forkid.NewID(chain.Config(), genesis, latest.Number.Uint64(), latest.Time)
5554
forkFilter = forkid.NewFilter(chain)
5655
)
@@ -92,10 +91,10 @@ func (p *Peer) readStatus68(networkID uint64, status *StatusPacket68, genesis co
9291
return nil
9392
}
9493

95-
func (p *Peer) handshake69(networkID uint64, chain *core.BlockChain, rangeMsg BlockRangeUpdatePacket) error {
94+
func (p *Peer) handshake69(networkID uint64, chain forkid.Blockchain, rangeMsg BlockRangeUpdatePacket) error {
9695
var (
9796
genesis = chain.Genesis()
98-
latest = chain.CurrentBlock()
97+
latest = chain.CurrentHeader()
9998
forkID = forkid.NewID(chain.Config(), genesis, latest.Number.Uint64(), latest.Time)
10099
forkFilter = forkid.NewFilter(chain)
101100
)

0 commit comments

Comments
 (0)