-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mining hash / operation queues proposal #12
base: master
Are you sure you want to change the base?
Conversation
Looks great so far. I'll do some testing and merge it ASAP if all looks good. Just as a side note: I really appreciate you helping out with this project! This is the first time anyone has taken an interest in any of my projects at this level, and submitting pull requests for me. It really means a lot. |
A note on unit tests: |
needs some proper unit tests.
with the added queues x3 - we can reliably interject / cancel when other signals (block found remote / propagation) occur from block chain.
so the mining queue is basically the recursion to find next block.
the hashing queue is parallel threaded to determine hash
the block found queue I added as a sanity check to prevent two blocks being found at same time.
There's also a block found state variable to help orchestrate things.
you will notice that / they hang off the blockchain queue
the SynchronizedArray should prevent the underlying mutation of the blockchain data while all the threads are in action.
I've been testing and it seems stable.
eg.
There's some delays that are added as bandaids which basically give the process some cycles on other threads to catch up.
eg
before we call mine - we sleep for a few milliseconds.
This delay variable value is more of an art that a science.