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.
This commit is contained in:
ASuciuX
2024-05-15 19:55:01 +03:00
parent 6d5b66853f
commit 9fab39f340

View File

@@ -371,7 +371,6 @@ impl SignerRunLoop<Vec<OperationResult>, 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<Vec<OperationResult>, 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<Vec<OperationResult>, 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<Vec<OperationResult>, 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!(