-
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
Function detectSubTreeRows() is incorrect #351
Comments
What |
It means that the entire accumulator is 9 rows tall.
This accumulator is 4 rows tall. |
According to the comments documentation of To validate and also for the fun of it I followed the (left) childs of position 839 down to the bottom and then executed
By the way, after putting a debug message into the loop body of I'm both a golang and an utreexo noob, but find this a really interesting project, would love to contribute. I used this issue as kind of an entrypoint/motivation to understand more about the fascinating world of utreexo forests and trees, so thanks for creating it :) |
Hey @theStack That's a good catch! I didn't check up on the comments closely. My excuse would be that there's a new accumulator design that I'm currently implementing that allows for leaves to be in rows other than row 0, which was why I thought this was a bug.
Yeah I think it'd definitely be better to have some sort of check in there. Before the loop, maybe something like
Glad to hear that :) On the top of my head, I guess the one thing that's desperately needed is cleaning up the code so that comments/old-unused code is removed. Something that's more involved would be an utreexo/accumulator/pollardutil.go Line 167 in 1ff40de
utreexo/accumulator/pollardutil.go Line 189 in 1ff40de
You may also be interested in https://github.com/mit-dci/libutreexo, the implementation in C++ and maybe https://github.com/utreexo/utreexod, the full node with utreexo accumulators implemented (Go). @dergoegge also has a branch on his fork of Bitcoin Core with utreexo accumulators. |
detectSubTreeRows()
for the below case fails.position: 839, numLeaves: 300, forestRows: 9
should result in5
butdetectSubTreeRows()
returns8
.How to calculate the correct position:
839
's parent is931
.931
's parent is977
.977
's parent is1000
, which is a root.detectRow(1000, 9)
returns5
.However,
detectSubTreeRows(1000, 300, 9)
returns8
.Playground:
https://go.dev/play/p/LarcZzajT_3
The text was updated successfully, but these errors were encountered: