mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core/state: apply suggestions from review
This commit is contained in:
parent
66fc14ad58
commit
2a2c432410
2 changed files with 7 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ package state
|
|||
import (
|
||||
"fmt"
|
||||
"maps"
|
||||
"slices"
|
||||
"sort"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
|
@ -68,7 +69,7 @@ func newJournal() *journal {
|
|||
func (j *journal) Reset() {
|
||||
j.entries = j.entries[:0]
|
||||
j.validRevisions = j.validRevisions[:0]
|
||||
j.dirties = make(map[common.Address]int)
|
||||
clear(j.dirties)
|
||||
j.nextRevisionId = 0
|
||||
}
|
||||
|
||||
|
|
@ -140,8 +141,10 @@ func (j *journal) copy() *journal {
|
|||
entries = append(entries, j.entries[i].copy())
|
||||
}
|
||||
return &journal{
|
||||
entries: entries,
|
||||
dirties: maps.Clone(j.dirties),
|
||||
entries: entries,
|
||||
dirties: maps.Clone(j.dirties),
|
||||
validRevisions: slices.Clone(j.validRevisions),
|
||||
nextRevisionId: j.nextRevisionId,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -500,10 +500,10 @@ func (s *StateDB) SelfDestruct(addr common.Address) {
|
|||
// Regardless of whether it is already destructed or not, we do have to
|
||||
// journal the balance-change, if we set it to zero here.
|
||||
if !stateObject.Balance().IsZero() {
|
||||
stateObject.SetBalance(new(uint256.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||
if s.logger != nil && s.logger.OnBalanceChange != nil {
|
||||
s.logger.OnBalanceChange(addr, stateObject.Balance().ToBig(), new(big.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||
}
|
||||
stateObject.SetBalance(new(uint256.Int), tracing.BalanceDecreaseSelfdestruct)
|
||||
}
|
||||
// If it is already marked as self-destructed, we do not need to add it
|
||||
// for journalling a second time.
|
||||
|
|
|
|||
Loading…
Reference in a new issue