vsergeev / ntgbtminer

A no thrills getblocktemplate Bitcoin miner, written in Python.
MIT License
84 stars 42 forks source link

Bits from template are already in the right order, no reversal needed #3

Closed JustinTArthur closed 5 years ago

ngitzarak commented 5 years ago

This makes test_ntgbtminer.py fail even more

FAIL: test_block_hash (__main__.TestBlock)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_ntgbtminer.py", line 104, in test_block_hash
    self.assertEqual(header_hash, test_vector)
AssertionError: '287439e9148d21f4bbaf4073fb541285037786a2bcef8ec802e9e3383e611d71' != u'000000000000000a369033d52a4aa264844b50857f0c6104c555d53938e9c8d7'
JustinTArthur commented 5 years ago

Thanks. I was confused as the template attributes are sent down as if you were constructing the 4-byte message chunks that go directly in the SHA-256 compression function like some of the optimized mining softwares do. To construct a block header in actual order for passing to a full SHA-256 function like ntgbtminer does, you do exactly what is being done here and reverse all of the 4-byte chunks.