les: duplicate downloader and fetcher to allow progressive refactoring
This commit is contained in:
@ -30,12 +30,12 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/mclock"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/eth/downloader"
|
||||
ethproto "github.com/ethereum/go-ethereum/eth/protocols/eth"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/les"
|
||||
@ -67,7 +67,7 @@ type backend interface {
|
||||
HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
|
||||
GetTd(ctx context.Context, hash common.Hash) *big.Int
|
||||
Stats() (pending int, queued int)
|
||||
Downloader() *downloader.Downloader
|
||||
SyncProgress() ethereum.SyncProgress
|
||||
}
|
||||
|
||||
// fullNodeBackend encompasses the functionality necessary for a full node
|
||||
@ -777,7 +777,7 @@ func (s *Service) reportStats(conn *connWrapper) error {
|
||||
mining = fullBackend.Miner().Mining()
|
||||
hashrate = int(fullBackend.Miner().Hashrate())
|
||||
|
||||
sync := fullBackend.Downloader().Progress()
|
||||
sync := fullBackend.SyncProgress()
|
||||
syncing = fullBackend.CurrentHeader().Number.Uint64() >= sync.HighestBlock
|
||||
|
||||
price, _ := fullBackend.SuggestGasTipCap(context.Background())
|
||||
@ -786,7 +786,7 @@ func (s *Service) reportStats(conn *connWrapper) error {
|
||||
gasprice += int(basefee.Uint64())
|
||||
}
|
||||
} else {
|
||||
sync := s.backend.Downloader().Progress()
|
||||
sync := s.backend.SyncProgress()
|
||||
syncing = s.backend.CurrentHeader().Number.Uint64() >= sync.HighestBlock
|
||||
}
|
||||
// Assemble the node stats and send it to the server
|
||||
|
Reference in New Issue
Block a user