diff --git a/src/dynamic_honey_badger/builder.rs b/src/dynamic_honey_badger/builder.rs index 1bf57002..61aacb14 100644 --- a/src/dynamic_honey_badger/builder.rs +++ b/src/dynamic_honey_badger/builder.rs @@ -15,6 +15,8 @@ use crate::{Contribution, NetworkInfo, NodeIdT}; pub struct DynamicHoneyBadgerBuilder { /// Start in this era. era: u64, + /// Start in this epoch. + epoch: u64, /// Parameters controlling Honey Badger's behavior and performance. params: Params, _phantom: PhantomData<(C, N)>, @@ -24,6 +26,7 @@ impl Default for DynamicHoneyBadgerBuilder { fn default() -> Self { DynamicHoneyBadgerBuilder { era: 0, + epoch: 0, params: Params::default(), _phantom: PhantomData, } @@ -47,6 +50,12 @@ where self } + /// Sets the starting era to the given value. + pub fn epoch(&mut self, epoch: u64) -> &mut Self { + self.epoch = epoch; + self + } + /// Sets the maximum number of future epochs for which we handle messages simultaneously. pub fn max_future_epochs(&mut self, max_future_epochs: u64) -> &mut Self { self.params.max_future_epochs = max_future_epochs; @@ -78,6 +87,7 @@ where pub fn build(&mut self, netinfo: NetworkInfo) -> DynamicHoneyBadger { let DynamicHoneyBadgerBuilder { era, + epoch, params, _phantom, } = self; @@ -85,6 +95,7 @@ where let honey_badger = HoneyBadger::builder(arc_netinfo.clone()) .session_id(*era) + .epoch(*epoch) .params(params.clone()) .build();