diff --git a/ethereum/src/consensus.rs b/ethereum/src/consensus.rs index a95046cd..ad421b0c 100644 --- a/ethereum/src/consensus.rs +++ b/ethereum/src/consensus.rs @@ -179,8 +179,8 @@ impl, DB: Database> ConsensusClient { - if *shutdown_rx.borrow() { + result = shutdown_rx.changed() => { + if result.is_err() || *shutdown_rx.borrow_and_update() { info!(target: "helios::consensus", "shutting down consensus client"); break; } @@ -244,8 +244,8 @@ fn save_new_checkpoints( let mut last_saved_checkpoint = initial_checkpoint; loop { tokio::select! { - _ = shutdown_recv.changed() => { - if *shutdown_recv.borrow() { + result = shutdown_recv.changed() => { + if result.is_err() || *shutdown_recv.borrow_and_update() { break; } }