mimblewimble / cuckoo-miner

Mining wrapper around the Cuckoo Cycle proof of work system for the Grin/MimbleWimble blockchain.
Apache License 2.0
52 stars 16 forks source link

bug in meets_difficulty #16

Closed tromp closed 6 years ago

tromp commented 6 years ago

Looks to me like > should be >=

This would explain why the grin explorer only shows solutions whose difficulty strictly exceeds the minimum required. Everybody is mining at inflated difficulty.

ignopeverell commented 6 years ago

Yes, good catch. Wouldn't matter much with a much higher overall hash rate (graph rate?), but right now it's pretty visible.

yeastplume commented 6 years ago

Good catch, that code was incorrect, but actually wasn't having any adverse effects because grin was asking for anything with difficulty 0 or above to be returned (so it was getting diff 1s).

The real issue seemed to be within grin miner itself, with the same >= problem (i think this and the previous checks are holdover from changes in the difficulty calculation). Fixed this and ran on yeastmonster and diff 1 solutions are showing up in grin explorer now:

https://github.com/mimblewimble/grin/commit/959b1d3e8d2a7f4cfc49f482bfc9c517280f9163