Skip to content

Commit

Permalink
Merge pull request #2244 from niuxiaojie89/feature/bump-version-to-1.5.0
Browse files Browse the repository at this point in the history
Fix potential diffLayer origin pointer error
  • Loading branch information
benbaley authored Mar 6, 2024
2 parents 8e4bb1d + 8bbcb41 commit 14a10f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/state/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ func (t *Tree) Update(blockRoot common.Hash, parentRoot common.Hash, destructs m
// Save the new snapshot for later
t.lock.Lock()
defer t.lock.Unlock()
// Update 和 Cap 并发执行,cap 过程中可能已经更换了新的 diskLayer
diskLayer := t.disklayer()
if snap.origin.Root() != diskLayer.Root() {
snap.rebloom(diskLayer)
}

t.layers[snap.root] = snap
return nil
Expand Down

0 comments on commit 14a10f0

Please sign in to comment.