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
3a6fe69f
Unverified
Commit
3a6fe69f
authored
Sep 29, 2021
by
Martin Holst Swende
Committed by
GitHub
Sep 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/protocols/snap, trie: better error-handling (#23657)
parent
42bc1944
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
handler.go
eth/protocols/snap/handler.go
+1
-1
trie.go
trie/trie.go
+4
-4
No files found.
eth/protocols/snap/handler.go
View file @
3a6fe69f
...
...
@@ -469,7 +469,7 @@ func handleMessage(backend Backend, peer *Peer) error {
// Storage slots requested, open the storage trie and retrieve from there
account
,
err
:=
snap
.
Account
(
common
.
BytesToHash
(
pathset
[
0
]))
loads
++
// always account database reads, even for failures
if
err
!=
nil
{
if
err
!=
nil
||
account
==
nil
{
break
}
stTrie
,
err
:=
trie
.
NewSecure
(
common
.
BytesToHash
(
account
.
Root
),
triedb
)
...
...
trie/trie.go
View file @
3a6fe69f
...
...
@@ -176,6 +176,10 @@ func (t *Trie) TryGetNode(path []byte) ([]byte, int, error) {
}
func
(
t
*
Trie
)
tryGetNode
(
origNode
node
,
path
[]
byte
,
pos
int
)
(
item
[]
byte
,
newnode
node
,
resolved
int
,
err
error
)
{
// If non-existent path requested, abort
if
origNode
==
nil
{
return
nil
,
nil
,
0
,
nil
}
// If we reached the requested path, return the current node
if
pos
>=
len
(
path
)
{
// Although we most probably have the original node expanded, encoding
...
...
@@ -195,10 +199,6 @@ func (t *Trie) tryGetNode(origNode node, path []byte, pos int) (item []byte, new
}
// Path still needs to be traversed, descend into children
switch
n
:=
(
origNode
)
.
(
type
)
{
case
nil
:
// Non-existent path requested, abort
return
nil
,
nil
,
0
,
nil
case
valueNode
:
// Path prematurely ended, abort
return
nil
,
nil
,
0
,
nil
...
...
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