dcrtime icon indicating copy to clipboard operation
dcrtime copied to clipboard

fix: merklepath hashes format on proof file

Open tiagoalvesdulce opened this issue 2 years ago • 2 comments

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=="}

tiagoalvesdulce avatar Jan 27 '23 20:01 tiagoalvesdulce

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

davecgh avatar Jan 27 '23 20:01 davecgh

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.

davecgh avatar Jan 27 '23 20:01 davecgh