Skip to content

Commit

Permalink
Metrics:duplicate txs
Browse files Browse the repository at this point in the history
  • Loading branch information
lochjin committed Nov 4, 2023
1 parent 5005758 commit 9c866d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/blockchain/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ import (
var (
blockProcessTimer = metrics.NewRegisteredTimer("blockchain/process", nil)
blockConnectedNotifications = metrics.NewRegisteredTimer("blockchain/process/connectnotifications", nil)

duplicateTxsGauge = metrics.NewRegisteredGauge("blockchain/duplicatetxs", nil)
)
1 change: 1 addition & 0 deletions core/blockchain/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ func (b *BlockChain) updateBlockState(ib meerdag.IBlock, block *types.Serialized
return fmt.Errorf("No prev block:%d %s", ib.GetID(), ib.GetHash().String())
}
bs.Update(block, prev.GetState().(*state.BlockState), b.meerChain.GetCurHeader())
duplicateTxsGauge.Update(int64(bs.GetDuplicateTxsSize()))
b.BlockDAG().AddToCommit(ib)
return nil
}
Expand Down
4 changes: 4 additions & 0 deletions core/state/blockstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (b *BlockState) GetDuplicateTxs() []int {
return b.duplicateTxs
}

func (b *BlockState) GetDuplicateTxsSize() int {
return len(b.duplicateTxs)
}

func (b *BlockState) SetEVM(header *etypes.Header) {
b.evmNumber = header.Number.Uint64()
b.evmHash = header.Hash()
Expand Down

0 comments on commit 9c866d8

Please sign in to comment.