diff --git a/internal/chain/engine.go b/internal/chain/engine.go index 3793753f5..b730e7e8e 100644 --- a/internal/chain/engine.go +++ b/internal/chain/engine.go @@ -309,8 +309,10 @@ func (e *engineImpl) Finalize( func payoutUndelegations( chain engine.ChainReader, header *block.Header, state *state.DB, ) error { - utils.AnalysisStart("payoutUndelegations") - defer utils.AnalysisEnd("payoutUndelegations") + currentHeader := chain.CurrentHeader() + nowEpoch, blockNow := currentHeader.Epoch(), currentHeader.Number() + utils.AnalysisStart("payoutUndelegations", nowEpoch, blockNow) + defer utils.AnalysisEnd("payoutUndelegations", nowEpoch, blockNow) validators, err := chain.ReadValidatorList() countTrack := map[common.Address]int{} diff --git a/internal/chain/reward.go b/internal/chain/reward.go index 1b33125b1..75dfcbdf9 100644 --- a/internal/chain/reward.go +++ b/internal/chain/reward.go @@ -84,6 +84,8 @@ func AccumulateRewards( header *block.Header, beaconChain engine.ChainReader, ) (reward.Reader, error) { blockNum := header.Number().Uint64() + currentHeader := beaconChain.CurrentHeader() + nowEpoch, blockNow := currentHeader.Epoch(), currentHeader.Number() if blockNum == 0 { // genesis block has no parent to reward. @@ -98,7 +100,7 @@ func AccumulateRewards( // After staking if bc.Config().IsStaking(header.Epoch()) && bc.CurrentHeader().ShardID() == shard.BeaconChainShardID { - utils.AnalysisStart("accumulateRewardBeaconchainSelfPayout") + utils.AnalysisStart("accumulateRewardBeaconchainSelfPayout", nowEpoch, blockNow) defaultReward := network.BaseStakedReward beaconCurrentEpoch := beaconChain.CurrentHeader().Epoch() // TODO Use cached result in off-chain db instead of full computation @@ -166,9 +168,9 @@ func AccumulateRewards( } } } - utils.AnalysisEnd("accumulateRewardBeaconchainSelfPayout") + utils.AnalysisEnd("accumulateRewardBeaconchainSelfPayout", nowEpoch, blockNow) - utils.AnalysisStart("accumulateRewardShardchainPayout") + utils.AnalysisStart("accumulateRewardShardchainPayout", nowEpoch, blockNow) // Handle rewards for shardchain if cxLinks := header.CrossLinks(); len(cxLinks) > 0 { crossLinks := types.CrossLinks{} @@ -291,7 +293,7 @@ func AccumulateRewards( } } } - utils.AnalysisEnd("accumulateRewardShardchainPayout") + utils.AnalysisEnd("accumulateRewardShardchainPayout", nowEpoch, blockNow) return network.NewStakingEraRewardForRound(newRewards, missing), nil } return network.EmptyPayout, nil diff --git a/node/node_newblock.go b/node/node_newblock.go index e6c9acced..bccfd0527 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -84,8 +84,10 @@ func (node *Node) WaitForConsensusReadyV2(readySignal chan struct{}, stopChan ch } func (node *Node) proposeNewBlock() (*types.Block, error) { - utils.AnalysisStart("proposeNewBlock") - defer utils.AnalysisEnd("proposeNewBlock") + currentHeader := node.Blockchain().CurrentHeader() + nowEpoch, blockNow := currentHeader.Epoch(), currentHeader.Number() + utils.AnalysisStart("proposeNewBlock", nowEpoch, blockNow) + defer utils.AnalysisEnd("proposeNewBlock", nowEpoch, blockNow) node.Worker.UpdateCurrent()