Skip to content

Commit 11fa450

Browse files
committed
fix: correctly initialize latest l1msg gauge
1 parent 048db62 commit 11fa450

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

core/blockchain.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ var defaultCacheConfig = &CacheConfig{
149149
SnapshotWait: true,
150150
}
151151

152+
func updateHeadL1msgGauge(block *types.Block) {
153+
for _, tx := range block.Transactions() {
154+
if msg := tx.AsL1MessageTx(); msg != nil {
155+
// Queue index is guaranteed to fit into int64.
156+
headL1MessageGauge.Update(int64(msg.QueueIndex))
157+
} else {
158+
// No more L1 messages in this block.
159+
break
160+
}
161+
}
162+
}
163+
152164
// BlockChain represents the canonical chain given a database with a genesis
153165
// block. The Blockchain manages chain imports, reverts, chain reorganisations.
154166
//
@@ -423,6 +435,9 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par
423435
triedb.SaveCachePeriodically(bc.cacheConfig.TrieCleanJournal, bc.cacheConfig.TrieCleanRejournal, bc.quit)
424436
}()
425437
}
438+
439+
updateHeadL1msgGauge(bc.CurrentBlock())
440+
426441
return bc, nil
427442
}
428443

@@ -1255,15 +1270,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
12551270
}
12561271

12571272
// Note the latest relayed L1 message queue index (if any)
1258-
for _, tx := range block.Transactions() {
1259-
if msg := tx.AsL1MessageTx(); msg != nil {
1260-
// Queue index is guaranteed to fit into int64.
1261-
headL1MessageGauge.Update(int64(msg.QueueIndex))
1262-
} else {
1263-
// No more L1 messages in this block.
1264-
break
1265-
}
1266-
}
1273+
updateHeadL1msgGauge(block)
12671274

12681275
parent := bc.GetHeaderByHash(block.ParentHash())
12691276
// block.Time is guaranteed to be larger than parent.Time,

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
VersionMajor = 5 // Major version component of the current release
2626
VersionMinor = 8 // Minor version component of the current release
27-
VersionPatch = 29 // Patch version component of the current release
27+
VersionPatch = 30 // Patch version component of the current release
2828
VersionMeta = "mainnet" // Version metadata to append to the version string
2929
)
3030

0 commit comments

Comments
 (0)