re-introduce sleep(0) calls when deriving keys #18225
Closed
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.
(and computing puzzle hashes) in wallet_state_manager
Purpose:
#17991 reorganized a loop that derived keys and computed puzzle hashes. The original loop had an
await sleep(0)
which was removed. This is believed to cause sync issues on hardware that's slow enough to cause this task to block too long.This PR reintroduces the
sleep(0)
, but since the two inner loops were hoisted out of the outer loop, there are now 3 places we may need to yield.Current Behavior:
Deriving keys and computing puzzle hashes are done in a task that's not interrupted, blocking other tasks, potentially causing them to time-out.
New Behavior:
Deriving keys and computing puzzle hashes are done in a task that's allowed to be interrupted, so that other tasks also get a chance to run, avoiding time-outs.
Testing Notes: