mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-08 12:21:09 +03:00
Stratum server should continue building new block if enter into sync state during a runing mining procedure (#2239)
This commit is contained in:
parent
c0507b2ab1
commit
69800bb6ec
1 changed files with 10 additions and 6 deletions
|
@ -708,12 +708,18 @@ impl StratumServer {
|
||||||
self.config.stratum_server_addr.clone().unwrap()
|
self.config.stratum_server_addr.clone().unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Initial Loop. Waiting node complete syncing
|
||||||
|
while self.sync_state.is_syncing() {
|
||||||
|
self.clean_workers(&mut stratum_stats.clone());
|
||||||
|
|
||||||
|
// Handle any messages from the workers
|
||||||
|
self.handle_rpc_requests(&mut stratum_stats.clone());
|
||||||
|
|
||||||
|
thread::sleep(Duration::from_millis(50));
|
||||||
|
}
|
||||||
|
|
||||||
// Main Loop
|
// Main Loop
|
||||||
loop {
|
loop {
|
||||||
// If we're fallen into sync mode, (or are just starting up,
|
|
||||||
// tell connected clients to stop what they're doing
|
|
||||||
let mining_stopped = self.sync_state.is_syncing();
|
|
||||||
|
|
||||||
// Remove workers with failed connections
|
// Remove workers with failed connections
|
||||||
num_workers = self.clean_workers(&mut stratum_stats.clone());
|
num_workers = self.clean_workers(&mut stratum_stats.clone());
|
||||||
|
|
||||||
|
@ -724,10 +730,8 @@ impl StratumServer {
|
||||||
// Build a new block if:
|
// Build a new block if:
|
||||||
// There is a new block on the chain
|
// There is a new block on the chain
|
||||||
// or We are rebuilding the current one to include new transactions
|
// or We are rebuilding the current one to include new transactions
|
||||||
// and we're not synching
|
|
||||||
// and there is at least one worker connected
|
// and there is at least one worker connected
|
||||||
if (current_hash != latest_hash || Utc::now().timestamp() >= deadline)
|
if (current_hash != latest_hash || Utc::now().timestamp() >= deadline)
|
||||||
&& !mining_stopped
|
|
||||||
&& num_workers > 0
|
&& num_workers > 0
|
||||||
{
|
{
|
||||||
let mut wallet_listener_url: Option<String> = None;
|
let mut wallet_listener_url: Option<String> = None;
|
||||||
|
|
Loading…
Reference in a new issue