Skip to content

Commit

Permalink
Propagate pipe.recv error
Browse files Browse the repository at this point in the history
  • Loading branch information
moshababo committed Nov 28, 2023
1 parent 8a577f9 commit aa85e36
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions node/actors/bft/src/testonly/ut_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ use crate::{
Consensus,
};
use rand::{rngs::StdRng, Rng};
use zksync_concurrency::{ctx, ctx::Ctx, scope};
use zksync_concurrency::{
ctx,
ctx::{Canceled, Ctx},
scope,
};
use zksync_consensus_network::io::ConsensusInputMessage;
use zksync_consensus_roles::validator::{
self, BlockHeader, CommitQC, ConsensusMsg, LeaderCommit, LeaderPrepare, Payload, Phase,
Expand Down Expand Up @@ -273,13 +277,12 @@ impl UTHarness {
.unwrap()
}

pub(crate) async fn recv_signed(&mut self) -> Option<Signed<ConsensusMsg>> {
let msg = self.pipe.recv(&self.ctx).await.unwrap();
match msg {
pub(crate) async fn recv_signed(&mut self) -> Result<Signed<ConsensusMsg>, Canceled> {
self.pipe.recv(&self.ctx).await.map(|output_message| match output_message {
OutputMessage::Network(ConsensusInputMessage {
message: signed, ..
}) => Some(signed),
}
}) => signed,
})
}

pub(crate) fn current_replica_view(&self) -> ViewNumber {
Expand Down

0 comments on commit aa85e36

Please sign in to comment.