core/filtermaps: check chain view consistency in makeSnapshot

This commit is contained in:
Zsolt Felfoldi 2025-04-16 09:51:36 +02:00
parent cdaa79ada1
commit 500497319e

View file

@ -256,14 +256,14 @@ func (f *FilterMaps) loadHeadSnapshot() error {
// makeSnapshot creates a snapshot of the current state of the rendered map. // makeSnapshot creates a snapshot of the current state of the rendered map.
func (r *mapRenderer) makeSnapshot() { func (r *mapRenderer) makeSnapshot() {
if r.iterator.blockNumber != r.currentMap.lastBlock { if r.iterator.blockNumber != r.currentMap.lastBlock || r.iterator.chainView != r.f.targetView {
panic("iterator state inconsistent with last block") panic("iterator state inconsistent with current rendered map")
} }
r.f.renderSnapshots.Add(r.currentMap.lastBlock, &renderedMap{ r.f.renderSnapshots.Add(r.currentMap.lastBlock, &renderedMap{
filterMap: r.currentMap.filterMap.fastCopy(), filterMap: r.currentMap.filterMap.fastCopy(),
mapIndex: r.currentMap.mapIndex, mapIndex: r.currentMap.mapIndex,
lastBlock: r.currentMap.lastBlock, lastBlock: r.currentMap.lastBlock,
lastBlockId: r.f.targetView.getBlockId(r.currentMap.lastBlock), lastBlockId: r.iterator.chainView.getBlockId(r.currentMap.lastBlock),
blockLvPtrs: r.currentMap.blockLvPtrs, blockLvPtrs: r.currentMap.blockLvPtrs,
finished: true, finished: true,
headDelimiter: r.iterator.lvIndex, headDelimiter: r.iterator.lvIndex,