-
Notifications
You must be signed in to change notification settings - Fork 795
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
Recalculate work from wallet #1895
Recalculate work from wallet #1895
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the difficulty lowers while we are doing a recalculation. When we look to make a transaction, will it still use the stored work we have and if so it will it cancel the current work be generated?
… same block Test to update difficulty if below active_difficulty work recalc config option default 4 sec or 1/4 of announcement period
created thread to handle work regeneration based on user configurable input
only recalc work if considered online, peer stake is greater than delta or min conf
formatting
formatting
test was reworked block is generated and started to be processed block is added to difficulty_reque updated logic to handle test network
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, considering @cryptocode review changes
P.S. I guess for RC2 we may need to add some metrics to delay recalculation during network spam |
do work regeneration drops junk blocks
pass lock into update_active_difficulty
moved transaction in do_work_regeneration outside loop to reuse check active and ledger for confirmation multiple times
repeat code to lambda
also should be fine as uint64_t since protected with mutex
…nt and also the mutex matches the mutex we expect to be locked. This is the expected behavior. Store a mapping of qualified_root -> state_block since we only regenerate work for state_blocks and saves some type checking and complexity. The absence of the qualified_root in active_transactions indicates the block has been confirmed or it was a fork that was rejected, either way we don't need to generate more work for it, we don't need a different way to check if it's confirmed. Remove items from generated_blocks before we iterate over it so we don't have to modify the container while iterating. Fixed an issue where we were modifying a container while iterating over it with multimap::erase Moving forward declarations to beginning of namespace declaration so they're all in one place. Separating work_watcher from wallets since its sufficiently complex i.e. has its own mutex and condition variable. Constify a lot of functions that aren't labeled as such but are.
only evict block if we can ensure blocks are confirmed
replaces #1860
blocks handled by the internal wallets will have work calculated using the active_difficulty if active_difficulty is greater
creates a thread in wallets to track these blocks and the time they were inserted, if they arent confirmed they are re inserted with an updated time.