diff --git a/core/state/state_object.go b/core/state/state_object.go index e0a02fba17..e7ef84879c 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -46,7 +46,7 @@ func (s Storage) String() (str string) { } func (s Storage) Copy() Storage { - cpy := make(Storage) + cpy := make(Storage, len(s)) for key, value := range s { cpy[key] = value } @@ -251,7 +251,7 @@ func (s *stateObject) SetState(db Database, key, value common.Hash) { func (s *stateObject) SetStorage(storage map[common.Hash]common.Hash) { // Allocate fake storage if it's nil. if s.fakeStorage == nil { - s.fakeStorage = make(Storage) + s.fakeStorage = make(Storage, len(storage)) } for key, value := range storage { s.fakeStorage[key] = value diff --git a/core/vm/logger.go b/core/vm/logger.go index 1aaf0a721a..f1d815c1bc 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -37,7 +37,7 @@ type Storage map[common.Hash]common.Hash // Copy duplicates the current storage. func (s Storage) Copy() Storage { - cpy := make(Storage) + cpy := make(Storage, len(s)) for key, value := range s { cpy[key] = value }