Skip to content

Commit

Permalink
go-quai/ethstats_package implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalank committed Aug 13, 2021
1 parent 012aad1 commit 32566ce
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions ethstats/ethstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,18 +563,18 @@ func (s *Service) reportLatency(conn *connWrapper) error {

// blockStats is the information to report about individual blocks.
type blockStats struct {
Number *big.Int `json:"number"`
Number []*big.Int `json:"number"`
Hash common.Hash `json:"hash"`
ParentHash common.Hash `json:"parentHash"`
ParentHash []common.Hash `json:"parentHash"`
Timestamp *big.Int `json:"timestamp"`
Miner common.Address `json:"miner"`
GasUsed uint64 `json:"gasUsed"`
GasLimit uint64 `json:"gasLimit"`
Diff string `json:"difficulty"`
GasUsed []uint64 `json:"gasUsed"`
GasLimit []uint64 `json:"gasLimit"`
Diff []*big.Int `json:"difficulty"`
TotalDiff string `json:"totalDifficulty"`
Txs []txStats `json:"transactions"`
TxHash common.Hash `json:"transactionsRoot"`
Root common.Hash `json:"stateRoot"`
TxHash []common.Hash `json:"transactionsRoot"`
Root []common.Hash `json:"stateRoot"`
Uncles uncleStats `json:"uncles"`
}

Expand Down Expand Up @@ -659,7 +659,7 @@ func (s *Service) assembleBlockStats(block *types.Block) *blockStats {
Miner: author,
GasUsed: header.GasUsed,
GasLimit: header.GasLimit,
Diff: header.Difficulty.String(),
Diff: header.Difficulty,
TotalDiff: td.String(),
Txs: txs,
TxHash: header.TxHash,
Expand All @@ -678,7 +678,7 @@ func (s *Service) reportHistory(conn *connWrapper, list []uint64) error {
indexes = append(indexes, list...)
} else {
// No indexes requested, send back the top ones
head := s.backend.CurrentHeader().Number.Int64()
head := s.backend.CurrentHeader().Number[types.QuaiNetworkContext].Int64()
start := head - historyUpdateRange + 1
if start < 0 {
start = 0
Expand Down Expand Up @@ -778,16 +778,16 @@ func (s *Service) reportStats(conn *connWrapper) error {
hashrate = int(fullBackend.Miner().Hashrate())

sync := fullBackend.Downloader().Progress()
syncing = fullBackend.CurrentHeader().Number.Uint64() >= sync.HighestBlock
syncing = fullBackend.CurrentHeader().Number[types.QuaiNetworkContext].Uint64() >= sync.HighestBlock

price, _ := fullBackend.SuggestGasTipCap(context.Background())
gasprice = int(price.Uint64())
if basefee := fullBackend.CurrentHeader().BaseFee; basefee != nil {
gasprice += int(basefee.Uint64())
gasprice += int(basefee[types.QuaiNetworkContext].Uint64())
}
} else {
sync := s.backend.Downloader().Progress()
syncing = s.backend.CurrentHeader().Number.Uint64() >= sync.HighestBlock
syncing = s.backend.CurrentHeader().Number[types.QuaiNetworkContext].Uint64() >= sync.HighestBlock
}
// Assemble the node stats and send it to the server
log.Trace("Sending node details to ethstats")
Expand Down

0 comments on commit 32566ce

Please sign in to comment.