ethstats: Address comments

This commit is contained in:
kaliubuntu0206 2023-10-23 20:49:22 +09:00
parent ca995303d9
commit 39a00a138f

View file

@ -81,7 +81,8 @@ type fullNodeBackend interface {
SuggestGasTipCap(ctx context.Context) (*big.Int, error) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
} }
// Mining // miningNodeBackend encompasses the functionality necessary for a mining node
// reporting to ethstats
type miningNodeBackend interface { type miningNodeBackend interface {
fullNodeBackend fullNodeBackend
Miner() *miner.Miner Miner() *miner.Miner
@ -785,10 +786,8 @@ func (s *Service) reportStats(conn *connWrapper) error {
gasprice int gasprice int
) )
// check if backend is a full node // check if backend is a full node
fullBackend, ok := s.backend.(fullNodeBackend) if fullBackend, ok := s.backend.(fullNodeBackend); ok {
if ok { if miningBackend, ok := s.backend.(miningNodeBackend); ok {
miningBackend, miningOk := s.backend.(miningNodeBackend)
if miningOk {
mining = miningBackend.Miner().Mining() mining = miningBackend.Miner().Mining()
hashrate = int(miningBackend.Miner().Hashrate()) hashrate = int(miningBackend.Miner().Hashrate())
} }