@@ -13,12 +13,11 @@ use mithril_common::{
13
13
/// Error linked to [MithrilStakeDistributionArtifactBuilder].
14
14
#[ derive( Debug , Error ) ]
15
15
pub enum MithrilStakeDistributionArtifactBuilderError {
16
- /// Could not get protocol parameters
17
- #[ error(
18
- "Could not build Mithril Stake Distribution artifact, no protocol parameters available."
19
- ) ]
20
- NoProtocolParameters ( ) ,
16
+ /// Protocol parameters are missing
17
+ #[ error( "Missing protocol parameter for epoch: '{0}'." ) ]
18
+ MissingProtocolParameters ( Epoch ) ,
21
19
}
20
+
22
21
/// A [MithrilStakeDistributionArtifact] builder
23
22
pub struct MithrilStakeDistributionArtifactBuilder {
24
23
multi_signer : Arc < RwLock < dyn MultiSigner > > ,
@@ -35,16 +34,15 @@ impl MithrilStakeDistributionArtifactBuilder {
35
34
impl ArtifactBuilder < Epoch , MithrilStakeDistribution > for MithrilStakeDistributionArtifactBuilder {
36
35
async fn compute_artifact (
37
36
& self ,
38
- beacon : Epoch ,
37
+ epoch : Epoch ,
39
38
_certificate : & Certificate ,
40
39
) -> StdResult < MithrilStakeDistribution > {
41
40
let multi_signer = self . multi_signer . read ( ) . await ;
42
- let protocol_parameters = multi_signer
43
- . get_next_protocol_parameters ( )
44
- . await ?
45
- . ok_or_else ( MithrilStakeDistributionArtifactBuilderError :: NoProtocolParameters ) ?;
41
+ let protocol_parameters = multi_signer. get_next_protocol_parameters ( ) . await ?. ok_or (
42
+ MithrilStakeDistributionArtifactBuilderError :: MissingProtocolParameters ( epoch) ,
43
+ ) ?;
46
44
Ok ( MithrilStakeDistribution :: new (
47
- beacon ,
45
+ epoch ,
48
46
multi_signer. get_next_signers_with_stake ( ) . await ?,
49
47
& protocol_parameters. into ( ) ,
50
48
) )
0 commit comments