Nexusoft / NexusMiner

Nexus Miner for Hash channel with FPGA/GPU/CPU pool and solo.
GNU General Public License v3.0
8 stars 6 forks source link

hash algorithm and software worker #1

Closed ahatstat closed 3 years ago

ahatstat commented 3 years ago

added a software hash worker for test purposes. @beuschl Where do I create the worker? For the worker, I'm not sure I understand the purpose of the void std::unique_ptr block. should this just be a const reference? Also i'm not sure how to use the callback. maybe you can help me with an example.

beuschl commented 3 years ago

added a software hash worker for test purposes. @beuschl Where do I create the worker? For the worker, I'm not sure I understand the purpose of the void std::unique_ptrLLP::CBlock block. should this just be a const reference? Also i'm not sure how to use the callback. maybe you can help me with an example.

Hi, after working with the interface you are right, the "block" should be const& because of possible multiple workers. You used the callback right, but I would suggest that you use the m_io_context (parameter for constructor) and when you call the callback you make something like m_io_context->post(callback). With this you are putting the callback in the io_queue and it will be called in the io_context and not in your thread

Also when you get called with set_block(...) for a new block you should interrupt your thread/work and restart with the new data (also invalidate old callback and set the given callback and so on), I think you know what I mean