New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trie sync fixes #2570
Trie sync fixes #2570
Conversation
- made the trie syncer search in the trie database before requesting missing trie nodes
663b8ed
@@ -90,3 +90,9 @@ var ErrInvalidLevelValue = errors.New("invalid trie level in memory value") | |||
|
|||
// ErrNilTrieSyncStatistics signals that a nil trie sync statistics handler was provided | |||
var ErrNilTrieSyncStatistics = errors.New("nil trie sync statistics handler") | |||
|
|||
// ErrContextClosing signals that the parent context requested the closing of its children |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
children of the corn :)
log.Trace("trie node intercepted", "hash", hash) | ||
|
||
n, ok := ts.nodesForTrie[string(hash)] | ||
if !ok || n.received { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was moved from the sync.go file. Used only in unit tests. Guess it is ok as the node is ignored if it does not exists or already received
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
} | ||
err = existingNode.setHash() | ||
if err != nil { | ||
return nil, ErrNodeNotFound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrNodeNotFound ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deliberately returned as ErrNodeNotFound because that will trigger a request (for some reason the node's hash was not computed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
data/trie/sync_test.go
Outdated
t.Parallel() | ||
|
||
timeout := time.Second * 200 | ||
marsh, hasher := getTestMarshAndHasher() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
marsh sounds weird, also in the method name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
992ff8a
ba1f222
Added 2 fixes that will further improve trie synchronization when the node is in the bootstrap process