mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
Share reference with state object and stateDB's trie for copy operation.
This commit is contained in:
parent
f6064f32c4
commit
faa0957d9a
1 changed files with 9 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
"github.com/ethereum/go-ethereum/trie"
|
||||||
"github.com/ethereum/go-ethereum/trie/trienode"
|
"github.com/ethereum/go-ethereum/trie/trienode"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
)
|
)
|
||||||
|
|
@ -494,8 +495,15 @@ func (s *stateObject) deepCopy(db *StateDB) *stateObject {
|
||||||
selfDestructed: s.selfDestructed,
|
selfDestructed: s.selfDestructed,
|
||||||
newContract: s.newContract,
|
newContract: s.newContract,
|
||||||
}
|
}
|
||||||
if s.trie != nil {
|
|
||||||
|
switch s.trie.(type) {
|
||||||
|
case *trie.VerkleTrie:
|
||||||
|
// In the Verkle case, the stateObject's trie shares the same reference as the StateDB's trie.
|
||||||
|
obj.trie = db.trie
|
||||||
|
case *trie.StateTrie:
|
||||||
obj.trie = mustCopyTrie(s.trie)
|
obj.trie = mustCopyTrie(s.trie)
|
||||||
|
case nil:
|
||||||
|
// do nothing
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue