mirror of https://github.com/poanetwork/hbbft.git
Properly handle `cfg.batch_size` and `cfg.contribution_size` in tests.
This commit is contained in:
parent
71a7331958
commit
bdc4f5b7df
|
@ -127,7 +127,11 @@ impl<N> DropAndReAddProgress<usize, N>
|
||||||
where
|
where
|
||||||
N: NodeIdT + Serialize + DeserializeOwned + Rand,
|
N: NodeIdT + Serialize + DeserializeOwned + Rand,
|
||||||
{
|
{
|
||||||
fn from_net(net: &VirtualNet<DynamicHoneyBadger<Vec<usize>, N>>) -> Self {
|
fn new(
|
||||||
|
net: &VirtualNet<DynamicHoneyBadger<Vec<usize>, N>>,
|
||||||
|
batch_size: usize,
|
||||||
|
contribution_size: usize,
|
||||||
|
) -> Self {
|
||||||
let total_txs = 200;
|
let total_txs = 200;
|
||||||
|
|
||||||
let expected_outputs: collections::BTreeMap<_, collections::BTreeSet<_>> = net
|
let expected_outputs: collections::BTreeMap<_, collections::BTreeSet<_>> = net
|
||||||
|
@ -145,8 +149,8 @@ where
|
||||||
awaiting_addition: net.correct_nodes().map(|n| n.id().clone()).collect(),
|
awaiting_addition: net.correct_nodes().map(|n| n.id().clone()).collect(),
|
||||||
expected_outputs,
|
expected_outputs,
|
||||||
queues,
|
queues,
|
||||||
batch_size: 10,
|
batch_size,
|
||||||
contribution_size: 10,
|
contribution_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +335,7 @@ fn do_drop_and_readd(cfg: TestConfig) {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// We are tracking (correct) nodes' state through the process by ticking them off individually.
|
// We are tracking (correct) nodes' state through the process by ticking them off individually.
|
||||||
let mut progress = DropAndReAddProgress::from_net(&net);
|
let mut progress = DropAndReAddProgress::new(&net, cfg.batch_size, cfg.contribution_size);
|
||||||
|
|
||||||
// For each node, select transactions randomly from the queue and propose them.
|
// For each node, select transactions randomly from the queue and propose them.
|
||||||
for (&id, queue) in &mut queues {
|
for (&id, queue) in &mut queues {
|
||||||
|
|
Loading…
Reference in New Issue