-
Notifications
You must be signed in to change notification settings - Fork 60
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
accumulator: PolNode remember doesn't work as intended #285
Comments
Mostly trying to get a
I think this function should work but since n.niece[0] isn't really n, it causes infinite recursion when following |
I actually think that the current approach works as intended but may lead to some extra memory usage is some cases.
We want to remember the proof for a leaf but not necessarily the leaf itself. If
In your example this is what we want, Lets assume we have this
what happens if the proof for We swap
now what happens if
We first swap
now Extra memory usage I think this approach might waste memory through chains of deleted nodes:
Here both
and after the transform is complete:
Since |
The way we currently have implemented the remember functionality is to have the
niece[0]
be itself. However, this property doesn't hold the way we currently have implementedaddOne()
.utreexo/accumulator/pollard.go
Lines 151 to 154 in 3f55cb1
In this code snippet, we point the
niece[0]
to to itself to prevent the node from being pruned.Example:
Here the leaf count is 2 and is
10
in binary. There is a 0 immediately so we can just simply append. The result is:Adding one more leaf is where things go wrong. The leaf count is now 3 and is
11
in binary. So we must start destroying roots now. We add a leaf to the root02
and have this midstate:If
03
was to be remembered,03.niece[0]
would be a pointer to03
. But because of this code here:utreexo/accumulator/pollard.go
Line 168 in 3f55cb1
02.niece[0]
now points to03
. Not at all what we're intending. I haven't yet tracked down where these leaves get forgotten but there's def some random leaves that stick around because of this.EDIT:
I've added this snippet in
TestCache()
and the test fails.EDIT EDIT:
I've just realized that the leaf could have been remembered as a proof for its sibling. This test is correct I believe:
The text was updated successfully, but these errors were encountered: