mirror of https://github.com/poanetwork/hbbft.git
Make Step::extend_with must_use.
This commit is contained in:
parent
7677f6343c
commit
ee99aad266
|
@ -439,7 +439,7 @@ fn main() {
|
|||
.build_with_transactions(txs.clone(), rng)
|
||||
.expect("instantiate QueueingHoneyBadger");
|
||||
let (sq, mut step) = SenderQueue::builder(qhb, peer_ids.into_iter()).build(our_id);
|
||||
step.extend_with(qhb_step, Message::from);
|
||||
assert!(step.extend_with(qhb_step, Message::from).is_empty());
|
||||
(sq, step)
|
||||
};
|
||||
|
||||
|
|
|
@ -117,10 +117,7 @@ where
|
|||
}
|
||||
|
||||
/// Creates a new Queueing Honey Badger instance with an empty buffer.
|
||||
pub fn build<R: Rng>(self, rng: &mut R) -> Result<QueueingHoneyBadgerWithStep<T, N, Q>>
|
||||
where
|
||||
R: 'static + Rng + Send + Sync,
|
||||
{
|
||||
pub fn build<R: Rng>(self, rng: &mut R) -> Result<QueueingHoneyBadgerWithStep<T, N, Q>> {
|
||||
self.build_with_transactions(None, rng)
|
||||
}
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ impl<M, O, N> Step<M, O, N> {
|
|||
}
|
||||
|
||||
/// Extends `self` with `other`s messages and fault logs, and returns `other.output`.
|
||||
#[must_use]
|
||||
pub fn extend_with<M2, O2, FM>(&mut self, other: Step<M2, O2, N>, f_msg: FM) -> Vec<O2>
|
||||
where
|
||||
FM: Fn(M2) -> M,
|
||||
|
|
|
@ -164,9 +164,8 @@ where
|
|||
let mut rng = rand::thread_rng().gen::<Isaac64Rng>();
|
||||
let (qhb, qhb_step) =
|
||||
QueueingHoneyBadger::builder_joining(our_id, secret_key, join_plan, &mut rng)
|
||||
.expect("failed to rebuild the node with a join plan")
|
||||
.batch_size(3)
|
||||
.build(&mut rng);
|
||||
.and_then(|builder| builder.batch_size(3).build(&mut rng))
|
||||
.expect("failed to rebuild the node with a join plan");
|
||||
let (sq, mut sq_step) = SenderQueue::builder(qhb, peer_ids.into_iter()).build(our_id);
|
||||
*node.instance_mut() = sq;
|
||||
sq_step.extend(qhb_step.map(|output| output, Message::from));
|
||||
|
@ -193,7 +192,7 @@ fn new_queueing_hb(
|
|||
.build(&mut rng)
|
||||
.expect("failed to build QueueingHoneyBadger");
|
||||
let (sq, mut step) = SenderQueue::builder(qhb, peer_ids).build(our_id);
|
||||
step.extend(qhb_step.map(|output| output, Message::from));
|
||||
assert!(step.extend_with(qhb_step, Message::from).is_empty());
|
||||
(sq, step)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue