Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
dcb22a9f
Unverified
Commit
dcb22a9f
authored
5 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/state: fix account root hash update point
parent
a4cf2794
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
statedb.go
core/state/statedb.go
+9
-6
No files found.
core/state/statedb.go
View file @
dcb22a9f
...
...
@@ -466,6 +466,14 @@ func (s *StateDB) updateStateObject(obj *stateObject) {
panic
(
fmt
.
Errorf
(
"can't encode object at %x: %v"
,
addr
[
:
],
err
))
}
s
.
setError
(
s
.
trie
.
TryUpdate
(
addr
[
:
],
data
))
// If state snapshotting is active, cache the data til commit. Note, this
// update mechanism is not symmetric to the deletion, because whereas it is
// enough to track account updates at commit time, deletions need tracking
// at transaction boundary level to ensure we capture state clearing.
if
s
.
snap
!=
nil
{
s
.
snapAccounts
[
obj
.
addrHash
]
=
snapshot
.
AccountRLP
(
obj
.
data
.
Nonce
,
obj
.
data
.
Balance
,
obj
.
data
.
Root
,
obj
.
data
.
CodeHash
)
}
}
// deleteStateObject removes the given object from the state trie.
...
...
@@ -729,7 +737,7 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
// If state snapshotting is active, also mark the destruction there.
// Note, we can't do this only at the end of a block because multiple
// transactions within the same block might self destruct and then
// ressurrect an account
and
the snapshotter needs both events.
// ressurrect an account
; but
the snapshotter needs both events.
if
s
.
snap
!=
nil
{
s
.
snapDestructs
[
obj
.
addrHash
]
=
struct
{}{}
// We need to maintain account deletions explicitly (will remain set indefinitely)
delete
(
s
.
snapAccounts
,
obj
.
addrHash
)
// Clear out any previously updated account data (may be recreated via a ressurrect)
...
...
@@ -737,11 +745,6 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
}
}
else
{
obj
.
finalise
()
// If state snapshotting is active, cache the data til commit
if
s
.
snap
!=
nil
{
s
.
snapAccounts
[
obj
.
addrHash
]
=
snapshot
.
AccountRLP
(
obj
.
data
.
Nonce
,
obj
.
data
.
Balance
,
obj
.
data
.
Root
,
obj
.
data
.
CodeHash
)
}
}
s
.
stateObjectsPending
[
addr
]
=
struct
{}{}
s
.
stateObjectsDirty
[
addr
]
=
struct
{}{}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment