fix: do not reuse same snapshot twice (#435)

fix: create new snapshot
This commit is contained in:
Péter Garamvölgyi 2023-08-03 16:45:45 +02:00 committed by GitHub
parent 5b0b08b104
commit f87eb3127a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -853,6 +853,8 @@ func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Addres
// revert to snapshot for calling `core.ApplyMessage` again, (both `traceEnv.GetBlockTrace` & `core.ApplyTransaction` will call `core.ApplyMessage`)
w.current.state.RevertToSnapshot(snap)
// create new snapshot for `core.ApplyTransaction`
snap = w.current.state.Snapshot()
receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &coinbase, w.current.gasPool, w.current.state, w.current.header, tx, &w.current.header.GasUsed, *w.chain.GetVMConfig())
if err != nil {
w.current.state.RevertToSnapshot(snap)

View file

@ -24,7 +24,7 @@ import (
const (
VersionMajor = 4 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 15 // Patch version component of the current release
VersionPatch = 16 // Patch version component of the current release
VersionMeta = "sepolia" // Version metadata to append to the version string
)