Mining hash / operation queues proposal - #12
Open
johndpope wants to merge 13 commits into
Open
Conversation
added 13 commits
January 15, 2018 11:52
Owner
|
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. |
Owner
|
A note on unit tests: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.