mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
refactor: simplify ccc revert to snapshot (#480)
* simplify ccc revert to snapshot * Update version.go --------- Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
parent
6992cfe8c5
commit
d02a410b36
2 changed files with 4 additions and 8 deletions
|
|
@ -895,15 +895,14 @@ func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Addres
|
|||
traces, err := w.current.traceEnv.GetBlockTrace(
|
||||
types.NewBlockWithHeader(w.current.header).WithBody([]*types.Transaction{tx}, nil),
|
||||
)
|
||||
// `w.current.traceEnv.State` & `w.current.state` share a same pointer to the state, so only need to revert `w.current.state`
|
||||
// revert to snapshot for calling `core.ApplyMessage` again, (both `traceEnv.GetBlockTrace` & `core.ApplyTransaction` will call `core.ApplyMessage`)
|
||||
w.current.state.RevertToSnapshot(snap)
|
||||
if err != nil {
|
||||
// `w.current.traceEnv.State` & `w.current.state` share a same pointer to the state, so only need to revert `w.current.state`
|
||||
w.current.state.RevertToSnapshot(snap)
|
||||
return nil, err
|
||||
}
|
||||
accRows, err = w.circuitCapacityChecker.ApplyTransaction(traces)
|
||||
if err != nil {
|
||||
// `w.current.traceEnv.State` & `w.current.state` share a same pointer to the state, so only need to revert `w.current.state`
|
||||
w.current.state.RevertToSnapshot(snap)
|
||||
return nil, err
|
||||
}
|
||||
log.Trace(
|
||||
|
|
@ -912,9 +911,6 @@ func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Addres
|
|||
"txhash", tx.Hash(),
|
||||
"accRows", accRows,
|
||||
)
|
||||
|
||||
// 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`
|
||||
|
|
|
|||
|
|
@ -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 = 48 // Patch version component of the current release
|
||||
VersionPatch = 49 // Patch version component of the current release
|
||||
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue