-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix random polNodes sticking around #288
Conversation
try:
and for
|
The last part of my comment here might explain why there are random nodes sticking around. |
9ff0f0b
to
baff52e
Compare
polnodes that are to be remembered are no longer marked with n.niece[0] = n but with a new remember bool in the polNode struct. TestCache is modified to test for polNodes that aren't supposed to be cached, being cached.
271769e
to
bd9e174
Compare
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.
I feel like creating a special rememberNode
would be the easier patch with less side effects.
rememberNode
could either be a global or a field on Pollard
.
// All the leaves to be deleted should be set to be not remembered. | ||
// TODO there's probably a better way to do this than calling readPos | ||
// a whole lot. | ||
for _, del := range dels { |
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 would probably be better to set remember=false when swapping the leaves
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.
I did try to get that to work but TestCache()
kept failing and I bet there's a bunch of edge cases to handle. I'm leaning more towards just getting this in and then working on setting remember to false during swaps since that's an optimization.
niece [2]*polNode | ||
data Hash | ||
niece [2]*polNode | ||
remember bool |
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 creating a polLeaf
type would be good because the remember bool is stored on all nodes now but really only the leaves need it.
Both polNode
and polLeaf
would need to inherit from the same interface.
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.
Hmm yeah. I also hate the fact that niece
isn't nieces for roots and leaves. Maybe we can solve all these problems at once.
bd9e174
to
2530e2b
Compare
Pollard stats now also return the count of all the PolNodes in the entire pollard.
2530e2b
to
b8bcf19
Compare
OK - this fixes the bug but at the cost of increasing the memory usage around 17% (extra 8 bytes for the bool on all nodes). |
This PR is related with #287
EDIT:
Second commit adds pollard size to the stats, making it easier to keep track of the pollard size.