From 14340169fcca2e0a6fe8f5097d285866456d360d Mon Sep 17 00:00:00 2001 From: teor Date: Mon, 8 Feb 2021 11:16:39 +1000 Subject: [PATCH] Use `ServiceExt::oneshot` in `chain::init` --- zebra-consensus/src/chain.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/zebra-consensus/src/chain.rs b/zebra-consensus/src/chain.rs index 1458e00fde1..5c7e1c6a4be 100644 --- a/zebra-consensus/src/chain.rs +++ b/zebra-consensus/src/chain.rs @@ -122,7 +122,7 @@ where pub async fn init( config: Config, network: Network, - mut state_service: S, + state_service: S, ) -> Buffer, block::Hash, VerifyChainError>, Arc> where S: Service + Send + Clone + 'static, @@ -137,11 +137,13 @@ where .expect("hardcoded checkpoint list extends past sapling activation") }; + // Correctness: + // + // We use `ServiceExt::oneshot` to make sure every `poll_ready` has a + // matching `call`. See #1593 for details. let tip = match state_service - .ready_and() - .await - .unwrap() - .call(zs::Request::Tip) + .clone() + .oneshot(zs::Request::Tip) .await .unwrap() {