Skip to content

Commit 8e5ef03

Browse files
add double signed blocks metric (#1180)
* add ds metric * add 1 instead of 2
1 parent f8678d7 commit 8e5ef03

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

cmd/thor/node/metrics.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ var (
1515
metricBlockProcessedGas = metrics.LazyLoadGaugeVec("block_processed_gas_gauge", []string{"type"})
1616
metricBlockProcessedDuration = metrics.LazyLoadHistogram("block_processed_duration_ms", metrics.Bucket10s)
1717
metricChainForkCount = metrics.LazyLoadCounter("chain_fork_count")
18+
metricDoubleSignedBlocks = metrics.LazyLoadCounterVec("double_signed_blocks_counter", []string{"signer"})
1819
)

cmd/thor/node/node.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ func (n *Node) processBlock(newBlock *block.Block, stats *blockStats) (bool, err
338338
conflictBlock.Header().ID() != newBlock.Header().ID() &&
339339
conflictBlock.Header().StateRoot() != newBlock.Header().StateRoot() {
340340
log.Warn("Double signing", "block", shortID(newBlock.Header().ID()), "previous", shortID(thor.BytesToBytes32(conflict)))
341+
metricDoubleSignedBlocks().AddWithLabel(1, map[string]string{"signer": signer.String()})
341342
}
342343
}
343344

0 commit comments

Comments
 (0)