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
|
// not yet committed. The pending mutation is cached and will be applied
|
||||||
// all together
|
// all together
|
||||||
func (s *StateDB) markDelete(addr common.Address) {
|
func (s *StateDB) markDelete(addr common.Address) {
|
||||||
if _, ok := s.mutations[addr]; !ok {
|
v, ok := s.mutations[addr]
|
||||||
s.mutations[addr] = &mutation{}
|
if !ok {
|
||||||
|
v = &mutation{}
|
||||||
|
s.mutations[addr] = v
|
||||||
}
|
}
|
||||||
s.mutations[addr].applied = false
|
v.applied = false
|
||||||
s.mutations[addr].typ = deletion
|
v.typ = deletion
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StateDB) markUpdate(addr common.Address) {
|
func (s *StateDB) markUpdate(addr common.Address) {
|
||||||
if _, ok := s.mutations[addr]; !ok {
|
v, ok := s.mutations[addr]
|
||||||
s.mutations[addr] = &mutation{}
|
if !ok {
|
||||||
|
v = &mutation{}
|
||||||
|
s.mutations[addr] = v
|
||||||
}
|
}
|
||||||
s.mutations[addr].applied = false
|
v.applied = false
|
||||||
s.mutations[addr].typ = update
|
v.typ = update
|
||||||
}
|
}
|
||||||
|
|
||||||
// Witness retrieves the current state witness being collected.
|
// Witness retrieves the current state witness being collected.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue