Skip to content
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: merklepath hashes format on proof file #90

Open
tiagoalvesdulce opened this issue Jan 27, 2023 · 2 comments
Open

fix: merklepath hashes format on proof file #90

tiagoalvesdulce opened this issue Jan 27, 2023 · 2 comments

Comments

@tiagoalvesdulce
Copy link
Member

Current format:

"merklepath":{"NumLeaves":1,"Hashes":[[45,5,190,55,153,119,254,57,38,7,208,117,97,159,189,149,123,86,253,136,93,110,21,5,199,213,108,133,75,193,34,42]],"Flags":"AQ=="}

Desired format:

"merklepath": {"NumLeaves": 1,"Hashes": ["532f478d06a74de345fb84f83ec4806b6b54aba4fb0a64c007e297a2e503f99f"],"Flags": "AQ=="}
@davecgh
Copy link
Member

davecgh commented Jan 27, 2023

While you're at it, the flags shouldn't even be necessary either.

@davecgh
Copy link
Member

davecgh commented Jan 27, 2023

I should also note that pretty much all of the code in the merkle package in dcrtime could (and probably should) be updated for the new version of a proof file to mirror the merkle tree + inclusion proof bits from github.com/decred/dcrd/blockchain/standalone/v2 which are significantly more efficient, have simpler code, and are easier to use, than the ones here. For example, they don't require messing with the aforementioned bitmap flags.

Do note that dcrtime uses sha256 instead of blake256 for the hash calculations, so the code in question would need to be modified slightly to use sha256 accordingly.

Namely:

EDIT:

Also, in case it isn't otherwise obvious, much of the existing code would, of course, need to be kept for supporting legacy version 0 proofs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants