good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
3a6fe69f
Unverified
Commit
3a6fe69f
authored
Sep 29, 2021
by
Martin Holst Swende
Committed by
GitHub
Sep 29, 2021
Browse files
Options
Downloads
Patches
Plain Diff
eth/protocols/snap, trie: better error-handling (#23657)
parent
42bc1944
No related branches found
No related tags found
Loading
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
eth/protocols/snap/handler.go
+1
-1
1 addition, 1 deletion
eth/protocols/snap/handler.go
trie/trie.go
+4
-4
4 additions, 4 deletions
trie/trie.go
with
5 additions
and
5 deletions
eth/protocols/snap/handler.go
+
1
−
1
View file @
3a6fe69f
...
@@ -469,7 +469,7 @@ func handleMessage(backend Backend, peer *Peer) error {
...
@@ -469,7 +469,7 @@ func handleMessage(backend Backend, peer *Peer) error {
// Storage slots requested, open the storage trie and retrieve from there
// Storage slots requested, open the storage trie and retrieve from there
account
,
err
:=
snap
.
Account
(
common
.
BytesToHash
(
pathset
[
0
]))
account
,
err
:=
snap
.
Account
(
common
.
BytesToHash
(
pathset
[
0
]))
loads
++
// always account database reads, even for failures
loads
++
// always account database reads, even for failures
if
err
!=
nil
{
if
err
!=
nil
||
account
==
nil
{
break
break
}
}
stTrie
,
err
:=
trie
.
NewSecure
(
common
.
BytesToHash
(
account
.
Root
),
triedb
)
stTrie
,
err
:=
trie
.
NewSecure
(
common
.
BytesToHash
(
account
.
Root
),
triedb
)
...
...
This diff is collapsed.
Click to expand it.
trie/trie.go
+
4
−
4
View file @
3a6fe69f
...
@@ -176,6 +176,10 @@ func (t *Trie) TryGetNode(path []byte) ([]byte, int, error) {
...
@@ -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
)
{
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 we reached the requested path, return the current node
if
pos
>=
len
(
path
)
{
if
pos
>=
len
(
path
)
{
// Although we most probably have the original node expanded, encoding
// 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
...
@@ -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
// Path still needs to be traversed, descend into children
switch
n
:=
(
origNode
)
.
(
type
)
{
switch
n
:=
(
origNode
)
.
(
type
)
{
case
nil
:
// Non-existent path requested, abort
return
nil
,
nil
,
0
,
nil
case
valueNode
:
case
valueNode
:
// Path prematurely ended, abort
// Path prematurely ended, abort
return
nil
,
nil
,
0
,
nil
return
nil
,
nil
,
0
,
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment