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
328de180
Unverified
Commit
328de180
authored
Mar 04, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/state: fix resurrection state clearing and access
parent
dcb22a9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
state_object.go
core/state/state_object.go
+9
-0
statedb.go
core/state/statedb.go
+4
-1
No files found.
core/state/state_object.go
View file @
328de180
...
...
@@ -204,6 +204,15 @@ func (s *stateObject) GetCommittedState(db Database, key common.Hash) common.Has
if
metrics
.
EnabledExpensive
{
defer
func
(
start
time
.
Time
)
{
s
.
db
.
SnapshotStorageReads
+=
time
.
Since
(
start
)
}(
time
.
Now
())
}
// If the object was destructed in *this* block (and potentially resurrected),
// the storage has been cleared out, and we should *not* consult the previous
// snapshot about any storage values. The only possible alternatives are:
// 1) resurrect happened, and new slot values were set -- those should
// have been handles via pendingStorage above.
// 2) we don't have new values, and can deliver empty response back
if
_
,
destructed
:=
s
.
db
.
snapDestructs
[
s
.
addrHash
];
destructed
{
return
common
.
Hash
{}
}
enc
,
err
=
s
.
db
.
snap
.
Storage
(
s
.
addrHash
,
crypto
.
Keccak256Hash
(
key
[
:
]))
}
// If snapshot unavailable or reading from it failed, load from the database
...
...
core/state/statedb.go
View file @
328de180
...
...
@@ -595,6 +595,9 @@ func (s *StateDB) CreateAccount(addr common.Address) {
if
prev
!=
nil
{
newObj
.
setBalance
(
prev
.
data
.
Balance
)
}
if
s
.
snap
!=
nil
&&
prev
!=
nil
{
s
.
snapDestructs
[
prev
.
addrHash
]
=
struct
{}{}
}
}
func
(
db
*
StateDB
)
ForEachStorage
(
addr
common
.
Address
,
cb
func
(
key
,
value
common
.
Hash
)
bool
)
error
{
...
...
@@ -855,7 +858,7 @@ func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
log
.
Warn
(
"Failed to cap snapshot tree"
,
"root"
,
root
,
"layers"
,
127
,
"err"
,
err
)
}
}
s
.
snap
,
s
.
snap
Accounts
,
s
.
snapStorage
=
nil
,
nil
,
nil
s
.
snap
,
s
.
snap
Destructs
,
s
.
snapAccounts
,
s
.
snapStorage
=
nil
,
nil
,
nil
,
nil
}
return
root
,
err
}
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