mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
clone map by maps.Clone
This commit is contained in:
parent
d294dd04d5
commit
3295f8aa82
1 changed files with 2 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ package pathdb
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/VictoriaMetrics/fastcache"
|
"github.com/VictoriaMetrics/fastcache"
|
||||||
|
|
@ -90,12 +91,10 @@ func (b *nodebuffer) commit(nodes map[common.Hash]map[string]*trienode.Node) *no
|
||||||
// The nodes belong to original diff layer are still accessible even
|
// The nodes belong to original diff layer are still accessible even
|
||||||
// after merging, thus the ownership of nodes map should still belong
|
// after merging, thus the ownership of nodes map should still belong
|
||||||
// to original layer and any mutation on it should be prevented.
|
// to original layer and any mutation on it should be prevented.
|
||||||
current = make(map[string]*trienode.Node, len(subset))
|
|
||||||
for path, n := range subset {
|
for path, n := range subset {
|
||||||
current[path] = n
|
|
||||||
delta += int64(len(n.Blob) + len(path))
|
delta += int64(len(n.Blob) + len(path))
|
||||||
}
|
}
|
||||||
b.nodes[owner] = current
|
b.nodes[owner] = maps.Clone(subset)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for path, n := range subset {
|
for path, n := range subset {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue