Skip to content

Commit

Permalink
les: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Jan 26, 2021
1 parent 1bb8f16 commit e59a770
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions les/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import (
"time"

"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/les/flowcontrol"
lps "github.com/ethereum/go-ethereum/les/lespay/server"
"github.com/ethereum/go-ethereum/light"
Expand Down Expand Up @@ -52,6 +53,15 @@ func init() {
priorityPoolSetup.Connect(balanceTrackerSetup.BalanceField, balanceTrackerSetup.UpdateFlag) // NodeBalance implements nodePriority
}

type ethBackend interface {
ArchiveMode() bool
BlockChain() *core.BlockChain
BloomIndexer() *core.ChainIndexer
ChainDb() ethdb.Database
Synced() bool
TxPool() *core.TxPool
}

type LesServer struct {
lesCommons

Expand All @@ -76,7 +86,7 @@ type LesServer struct {
p2pSrv *p2p.Server
}

func NewLesServer(node *node.Node, e *eth.Ethereum, config *ethconfig.Config) (*LesServer, error) {
func NewLesServer(node *node.Node, e ethBackend, config *ethconfig.Config) (*LesServer, error) {
ns := nodestate.NewNodeStateMachine(nil, nil, mclock.System{}, serverSetup)
// Collect les protocol version information supported by local node.
lesTopics := make([]discv5.Topic, len(AdvertiseProtocolVersions))
Expand Down

0 comments on commit e59a770

Please sign in to comment.