Add `start_epoch` to config.

This commit is contained in:
c0gent 2018-10-17 10:47:13 -07:00
parent 926582cd29
commit 8fe128f4b5
No known key found for this signature in database
GPG Key ID: 9CC25E71A743E892
2 changed files with 8 additions and 1 deletions

View File

@ -51,6 +51,9 @@ const DEFAULT_KEYGEN_PEER_COUNT: usize = 2;
// debugging.
const DEFAULT_OUTPUT_EXTRA_DELAY_MS: u64 = 0;
/// Hydrabadger configuration options.
//
// TODO: Convert to builder.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Config {
pub batch_size: usize,
@ -60,6 +63,7 @@ pub struct Config {
pub txn_gen_bytes: usize,
pub keygen_peer_count: usize,
pub output_extra_delay_ms: u64,
pub start_epoch: u64,
}
impl Config {
@ -71,6 +75,7 @@ impl Config {
txn_gen_bytes: DEFAULT_TXN_GEN_BYTES,
keygen_peer_count: DEFAULT_KEYGEN_PEER_COUNT,
output_extra_delay_ms: DEFAULT_OUTPUT_EXTRA_DELAY_MS,
start_epoch: 0,
}
}
}

View File

@ -228,7 +228,7 @@ impl<T: Contribution> State<T> {
local_uid: Uid,
local_sk: SecretKey,
jp: JoinPlan<Uid>,
_cfg: &Config,
cfg: &Config,
step_queue: &SegQueue<Step<T>>,
) -> Result<SegQueue<InputOrMessage<T>>, Error> {
let iom_queue_ret;
@ -237,6 +237,7 @@ impl<T: Contribution> State<T> {
ref mut iom_queue, ..
} => {
let (dhb, dhb_step) = DynamicHoneyBadger::builder()
.epoch(cfg.start_epoch)
.build_joining(local_uid, local_sk, jp)?;
step_queue.push(dhb_step);
@ -308,6 +309,7 @@ impl<T: Contribution> State<T> {
let netinfo = NetworkInfo::new(local_uid, sk_share, pk_set, local_sk, node_ids);
let dhb = DynamicHoneyBadger::builder()
.epoch(cfg.start_epoch)
.build(netinfo);
info!("");