Merge pull request #23159 from karalabe/ethstats-fix-fullnode

ethstats: fix full node interface post 1559
This commit is contained in:
Péter Szilágyi 2021-07-05 11:18:51 +03:00 committed by GitHub
commit c619562313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -77,7 +77,7 @@ type fullNodeBackend interface {
Miner() *miner.Miner Miner() *miner.Miner
BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
CurrentBlock() *types.Block CurrentBlock() *types.Block
SuggestPrice(ctx context.Context) (*big.Int, error) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
} }
// Service implements an Ethereum netstats reporting daemon that pushes local // Service implements an Ethereum netstats reporting daemon that pushes local
@ -780,8 +780,11 @@ func (s *Service) reportStats(conn *connWrapper) error {
sync := fullBackend.Downloader().Progress() sync := fullBackend.Downloader().Progress()
syncing = fullBackend.CurrentHeader().Number.Uint64() >= sync.HighestBlock syncing = fullBackend.CurrentHeader().Number.Uint64() >= sync.HighestBlock
price, _ := fullBackend.SuggestPrice(context.Background()) price, _ := fullBackend.SuggestGasTipCap(context.Background())
gasprice = int(price.Uint64()) gasprice = int(price.Uint64())
if basefee := fullBackend.CurrentHeader().BaseFee; basefee != nil {
gasprice += int(basefee.Uint64())
}
} else { } else {
sync := s.backend.Downloader().Progress() sync := s.backend.Downloader().Progress()
syncing = s.backend.CurrentHeader().Number.Uint64() >= sync.HighestBlock syncing = s.backend.CurrentHeader().Number.Uint64() >= sync.HighestBlock