-
Notifications
You must be signed in to change notification settings - Fork 198
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
More tries sync fixes #2967
More tries sync fixes #2967
Conversation
iulianpascalau
commented
Apr 7, 2021
- fixed the wrong trie node size estimation when inserting an intercepted trie node in the cache
- made the trie syncer to not depend upon a trie instance
- tweaked configs
data/trie/branchNode.go
Outdated
} | ||
|
||
// hasher + marshalizer + dirty flag = 2 * pointerSizeInBytes + 1 | ||
nodeSize := len(bn.hash) + 2*pointerSizeInBytes + 1 |
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.
maybe add a constant for "2"
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.
done
return 0 | ||
} | ||
|
||
// hasher + marshalizer + child + dirty flag = 3 * pointerSizeInBytes + 1 |
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.
maybe add a constant for "2"
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 is 3, btw :)
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.
done
data/trie/leafNode.go
Outdated
return 0 | ||
} | ||
|
||
// hasher + marshalizer + dirty flag = 2 * pointerSizeInBytes + 1 |
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.
maybe add a constant for "2"
@@ -285,10 +282,11 @@ func (ts *trieSyncer) getNode(hash []byte) (node, error) { | |||
|
|||
n, ok := ts.interceptedNodes.Get(hash) | |||
if ok { | |||
ts.interceptedNodes.Remove(hash) |
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.
the interceptor does not delete the unused infos ?
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.
no, it just stores in the cache what it receives. Just like in the case of transactions, blocks and so on.
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.
done