mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
core/state: optimize map usage
This commit is contained in:
parent
127d1f42bb
commit
2b4053c016
1 changed files with 12 additions and 8 deletions
|
|
@ -1479,19 +1479,23 @@ func (s *StateDB) SlotInAccessList(addr common.Address, slot common.Hash) (addre
|
|||
// not yet committed. The pending mutation is cached and will be applied
|
||||
// all together
|
||||
func (s *StateDB) markDelete(addr common.Address) {
|
||||
if _, ok := s.mutations[addr]; !ok {
|
||||
s.mutations[addr] = &mutation{}
|
||||
v, ok := s.mutations[addr]
|
||||
if !ok {
|
||||
v = &mutation{}
|
||||
s.mutations[addr] = v
|
||||
}
|
||||
s.mutations[addr].applied = false
|
||||
s.mutations[addr].typ = deletion
|
||||
v.applied = false
|
||||
v.typ = deletion
|
||||
}
|
||||
|
||||
func (s *StateDB) markUpdate(addr common.Address) {
|
||||
if _, ok := s.mutations[addr]; !ok {
|
||||
s.mutations[addr] = &mutation{}
|
||||
v, ok := s.mutations[addr]
|
||||
if !ok {
|
||||
v = &mutation{}
|
||||
s.mutations[addr] = v
|
||||
}
|
||||
s.mutations[addr].applied = false
|
||||
s.mutations[addr].typ = update
|
||||
v.applied = false
|
||||
v.typ = update
|
||||
}
|
||||
|
||||
// Witness retrieves the current state witness being collected.
|
||||
|
|
|
|||
Loading…
Reference in a new issue