-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: send syncing start/stop messages to miner
The mining loop is no longer async as it is wrapped by spawn_blocking(). Thus it can no longer await async futures. So we cannot check the GlobalState syncing flag, which requires an async lock acquisition. Instead, the main task sends StartSyncing and StopSyncing messages to the mining task which cancels the mining thread when it receives StartSyncing.
- Loading branch information
Showing
3 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ pub enum MainToMiner { | |
|
||
StopMining, | ||
StartMining, | ||
|
||
StartSyncing, | ||
StopSyncing, | ||
// SetCoinbasePubkey, | ||
} | ||
|
||
|