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
36f81118
Commit
36f81118
authored
Apr 05, 2019
by
gary rong
Committed by
Péter Szilágyi
Apr 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/state: fix state iterator (#19127)
* core/state: fix state iterator * core: fix state iterator more elegant
parent
7dd31947
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
statedb.go
core/state/statedb.go
+17
-4
interface.go
core/vm/interface.go
+1
-1
No files found.
core/state/statedb.go
View file @
36f81118
...
...
@@ -515,20 +515,33 @@ func (self *StateDB) CreateAccount(addr common.Address) {
}
}
func
(
db
*
StateDB
)
ForEachStorage
(
addr
common
.
Address
,
cb
func
(
key
,
value
common
.
Hash
)
bool
)
{
func
(
db
*
StateDB
)
ForEachStorage
(
addr
common
.
Address
,
cb
func
(
key
,
value
common
.
Hash
)
bool
)
error
{
so
:=
db
.
getStateObject
(
addr
)
if
so
==
nil
{
return
return
nil
}
it
:=
trie
.
NewIterator
(
so
.
getTrie
(
db
.
db
)
.
NodeIterator
(
nil
))
for
it
.
Next
()
{
key
:=
common
.
BytesToHash
(
db
.
trie
.
GetKey
(
it
.
Key
))
if
value
,
dirty
:=
so
.
dirtyStorage
[
key
];
dirty
{
cb
(
key
,
value
)
if
!
cb
(
key
,
value
)
{
return
nil
}
continue
}
cb
(
key
,
common
.
BytesToHash
(
it
.
Value
))
if
len
(
it
.
Value
)
>
0
{
_
,
content
,
_
,
err
:=
rlp
.
Split
(
it
.
Value
)
if
err
!=
nil
{
return
err
}
if
!
cb
(
key
,
common
.
BytesToHash
(
content
))
{
return
nil
}
}
}
return
nil
}
// Copy creates a deep, independent copy of the state.
...
...
core/vm/interface.go
View file @
36f81118
...
...
@@ -63,7 +63,7 @@ type StateDB interface {
AddLog
(
*
types
.
Log
)
AddPreimage
(
common
.
Hash
,
[]
byte
)
ForEachStorage
(
common
.
Address
,
func
(
common
.
Hash
,
common
.
Hash
)
bool
)
ForEachStorage
(
common
.
Address
,
func
(
common
.
Hash
,
common
.
Hash
)
bool
)
error
}
// CallContext provides a basic interface for the EVM calling conventions. The EVM
...
...
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