mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
core: rename to processingTime, time.Duration
This commit is contained in:
parent
eac2b2e5b4
commit
2cc1f5fca8
3 changed files with 8 additions and 6 deletions
|
|
@ -1778,7 +1778,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
|
|||
// Fire a single chain head event if we've progressed the chain
|
||||
defer func() {
|
||||
if lastCanon != nil && bc.CurrentBlock().Hash() == lastCanon.Hash() {
|
||||
bc.chainHeadFeed.Send(ChainHeadEvent{Header: lastCanon.Header(), Time: uint64(mclock.Now().Sub(stats.startTime))})
|
||||
bc.chainHeadFeed.Send(ChainHeadEvent{Header: lastCanon.Header(), ProcessingTime: mclock.Now().Sub(stats.startTime)})
|
||||
}
|
||||
}()
|
||||
// Start the parallel header verifier
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
|
|
@ -34,5 +36,5 @@ type ChainEvent struct {
|
|||
|
||||
type ChainHeadEvent struct {
|
||||
Header *types.Header
|
||||
Time uint64
|
||||
ProcessingTime time.Duration
|
||||
}
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ func (s uncleStats) MarshalJSON() ([]byte, error) {
|
|||
// reportBlock retrieves the current chain head and reports it to the stats server.
|
||||
func (s *Service) reportBlock(conn *connWrapper, header *core.ChainHeadEvent) error {
|
||||
// Gather the block details from the header or block chain
|
||||
details := s.assembleBlockStats(header.Header, header.Time)
|
||||
details := s.assembleBlockStats(header.Header, header.ProcessingTime)
|
||||
|
||||
// Short circuit if the block detail is not available.
|
||||
if details == nil {
|
||||
|
|
@ -625,7 +625,7 @@ func (s *Service) reportBlock(conn *connWrapper, header *core.ChainHeadEvent) er
|
|||
|
||||
// assembleBlockStats retrieves any required metadata to report a single block
|
||||
// and assembles the block stats. If block is nil, the current head is processed.
|
||||
func (s *Service) assembleBlockStats(header *types.Header, time uint64) *blockStats {
|
||||
func (s *Service) assembleBlockStats(header *types.Header, processingTime time.Duration) *blockStats {
|
||||
// Gather the block infos from the local blockchain
|
||||
var (
|
||||
txs []txStats
|
||||
|
|
@ -672,7 +672,7 @@ func (s *Service) assembleBlockStats(header *types.Header, time uint64) *blockSt
|
|||
TxHash: header.TxHash,
|
||||
Root: header.Root,
|
||||
Uncles: uncles,
|
||||
ProcessingTime: time,
|
||||
ProcessingTime: uint64(processingTime),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue