From 9fab39f3407388768fc5e8ceefc0745661e6a9bd Mon Sep 17 00:00:00 2001 From: ASuciuX Date: Wed, 15 May 2024 19:55:01 +0300 Subject: [PATCH] update to general signer message for users - it gets both cases: 1. reward set not determined 2. signer not registered without having to modify a lot of the current implementation only to parse an extra separation between them. --- stacks-signer/src/runloop.rs | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/stacks-signer/src/runloop.rs b/stacks-signer/src/runloop.rs index 35fb93b4c..7e8adc24f 100644 --- a/stacks-signer/src/runloop.rs +++ b/stacks-signer/src/runloop.rs @@ -371,7 +371,6 @@ impl SignerRunLoop, RunLoopCommand> for RunLoop { if let Some(cmd) = cmd { self.commands.push_back(cmd); } - if self.state == State::Uninitialized { if let Err(e) = self.initialize_runloop() { error!("Failed to initialize signer runloop: {e}."); @@ -391,11 +390,10 @@ impl SignerRunLoop, RunLoopCommand> for RunLoop { .as_ref() .expect("FATAL: cannot be an initialized signer with no reward cycle info.") .reward_cycle; - if self.state == State::NoRegisteredSigners { let next_reward_cycle = current_reward_cycle.saturating_add(1); if let Some(event) = event { - info!("Signer is not registered for the current reward cycle ({current_reward_cycle}). Reward set of upcoming reward cycle ({next_reward_cycle}) is not yet determined. Waiting for confirmation..."); + info!("Signer is not registered for the current reward cycle ({current_reward_cycle}). Reward set is not yet determined or signer is not registered for the upcoming reward cycle ({next_reward_cycle}). Waiting for confirmation..."); warn!("Ignoring event: {event:?}"); } return None; @@ -424,27 +422,6 @@ impl SignerRunLoop, RunLoopCommand> for RunLoop { error!("{signer}: failed to refresh DKG: {e}"); } } - - // Has been determined and we are still not registered - if self.state == State::NoRegisteredSigners { - let next_reward_cycle = current_reward_cycle.saturating_add(1); - if let Some(event) = event { - info!("Signer is not registered for the current reward cycle ({current_reward_cycle}) or the upcoming reward cycle ({next_reward_cycle}). Nothing to do"); - warn!("Ignoring event: {event:?}"); - } - return None; - } - - // Has been determined and we are registered - if self.state == State::RegisteredSigners { - let next_reward_cycle = current_reward_cycle.saturating_add(1); - if let Some(event) = event { - info!("Signer is (not) registered for the current reward cycle ({current_reward_cycle}) and the signer is registered for the upcoming reward cycle ({next_reward_cycle}). Nothing to do"); - warn!("Ignoring event: {event:?}"); - } - return None; - } - signer.refresh_coordinator(); if let Err(e) = signer.process_event( &self.stacks_client, @@ -456,12 +433,9 @@ impl SignerRunLoop, RunLoopCommand> for RunLoop { } if let Some(command) = self.commands.pop_front() { let reward_cycle = command.reward_cycle; - let next_reward_cycle = current_reward_cycle.saturating_add(1); if signer.reward_cycle != reward_cycle { warn!( - // Not registered for the next reward_cycle - // "{signer}: not registered for reward cycle {reward_cycle}. Ignoring command: {command:?}" - "Signer is registered for the current reward cycle ({reward_cycle}). Reward set of upcoming reward cycle ({next_reward_cycle}) is not yet determined." + "{signer}: not registered for reward cycle {reward_cycle}. Ignoring command: {command:?}" ); } else { info!(