VeriBlock/vbk-ri-btc

Some block hashes are shown in reverse order

Opened this issue · 1 comments

Using: BTCSQ Core version v0.19.99.0-9fa6fa0

Some block hashes are shown on the console in reverse order. For example block 12773 has hash 000000000000021d21309939d1cf9c0b601aabcde1783d471ded9b5633cea5d3 but is also shown as d3a5ce33569bed1d473d78e1cdab1a600b9ccfd1399930211d02000000000000.

2021-11-05T13:04:39Z [alt-cpp] [warn] comparePopScore: Comparing two chains. Current tip: ALT:12772:be71475c1385f9d277cbb038b48baad14260a78a4ea8661d5e04000000000000, Candidate: ALT:12773:d3a5ce33569bed1d473d78e1cdab1a600b9ccfd1399930211d02000000000000. Result: Candidate wins (-1), reason: candidate is valid and after current tip. 2021-11-05T13:04:39Z UpdateTip: new best=ALT:12773:000000000000021d21309939d1cf9c0b601aabcde1783d471ded9b5633cea5d3 VBK:2661385:000000000709b49377122b104446d1d61c0dc609643abaaf BTC:708319:00000000000000000002eb8079bd51ab39235269d0b288ff637599e3667023eb version=0x20080000 log2_work=68.686958 tx=15631 date='2021-11-05T13:03:02Z' progress=0.999943 cache=0.1MiB(1025txo) 2021-11-05T13:04:39Z [alt-cpp] [info] acceptBlock: Accept pop data: PopData{VBKs=2, VTBs=0, ATVs=38, version=1}, for the block: ALTBlockIndex(height=12774, hash=91e5ce459933d4c9c4537efd8b46c470fdb8155495531a75b402000000000000, next=0, status=1, header=AltBlock{height=12774, hash=91e5ce459933d4c9c4537efd8b46c470fdb8155495531a75b402000000000000}, ATVs=0[], VTBs=0[], VBKs=0[]) 2021-11-05T13:04:39Z [alt-cpp] [warn] comparePopScore: Comparing two chains. Current tip: ALT:12773:d3a5ce33569bed1d473d78e1cdab1a600b9ccfd1399930211d02000000000000, Candidate: ALT:12774:91e5ce459933d4c9c4537efd8b46c470fdb8155495531a75b402000000000000. Result: Candidate wins (-1), reason: candidate is valid and after current tip.

It is known issue. In short, we won't fix it in short/mid term, because it is only a "display" issue, not logic issue.
Fix for this may sound simple, but it is not.
It will hurt in long-term because some altchains may not put their hashes in "reversed" order to alt-integration-cpp.

Blame Satoshi Nakamoto for reversing hash in uint256 implementation in Bitcoin.