|
1 | 1 | use slog_scope::{crit, debug, error, info};
|
2 | 2 | use std::{fmt::Display, thread::sleep, time::Duration};
|
3 | 3 |
|
4 |
| -use mithril_common::entities::{Beacon, CertificatePending, Epoch, EpochSettings, SignerWithStake}; |
| 4 | +use mithril_common::{ |
| 5 | + crypto_helper::ProtocolInitializerError, |
| 6 | + entities::{Beacon, CertificatePending, Epoch, EpochSettings, SignerWithStake}, |
| 7 | +}; |
5 | 8 |
|
6 | 9 | use super::{Runner, RuntimeError};
|
7 | 10 |
|
@@ -304,15 +307,18 @@ impl StateMachine {
|
304 | 307 | .map_err(|e| RuntimeError::KeepState {
|
305 | 308 | message: format!("Could not update stake distribution in 'unregistered → registered' phase for epoch {:?}.", beacon.epoch),
|
306 | 309 | nested_error: Some(e) })?;
|
307 |
| - self.runner |
308 |
| - .register_signer_to_aggregator( |
309 |
| - epoch_settings.epoch, |
310 |
| - &epoch_settings.next_protocol_parameters, |
311 |
| - ) |
312 |
| - .await |
313 |
| - .map_err(|e| RuntimeError::KeepState { |
314 |
| - message: format!("Could not register to aggregator in 'unregistered → registered' phase for epoch {:?}.", beacon.epoch), |
315 |
| - nested_error: Some(e) })?; |
| 310 | + |
| 311 | + self.runner. register_signer_to_aggregator( |
| 312 | + epoch_settings.epoch, |
| 313 | + &epoch_settings.next_protocol_parameters, |
| 314 | + ) |
| 315 | + .await.map_err(|e| { |
| 316 | + if e.downcast_ref::<ProtocolInitializerError>().is_some(){ |
| 317 | + RuntimeError::Critical { message: format!("Could not register to aggregator in 'unregistered → registered' phase for epoch {:?}.", beacon.epoch), nested_error: Some(e) } |
| 318 | + }else{ |
| 319 | + RuntimeError::KeepState { message: format!("Could not register to aggregator in 'unregistered → registered' phase for epoch {:?}.", beacon.epoch), nested_error: Some(e) } |
| 320 | + } |
| 321 | + })?; |
316 | 322 |
|
317 | 323 | Ok(SignerState::Registered { beacon })
|
318 | 324 | }
|
|
0 commit comments