From c2590ce5261d1a03177a10a40021f9207ef60406 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 11 Jun 2020 22:09:51 +1000 Subject: [PATCH] consensus: Make future handling a little nicer Part of #428. --- Cargo.lock | 1 + zebra-consensus/Cargo.toml | 1 + zebra-consensus/src/verify.rs | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 9317db50..172abe64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2127,6 +2127,7 @@ version = "0.1.0" dependencies = [ "color-eyre", "eyre", + "futures-util", "tokio", "tower", "tracing", diff --git a/zebra-consensus/Cargo.toml b/zebra-consensus/Cargo.toml index 6ba3e135..81f0eeec 100644 --- a/zebra-consensus/Cargo.toml +++ b/zebra-consensus/Cargo.toml @@ -10,6 +10,7 @@ edition = "2018" [dependencies] zebra-chain = { path = "../zebra-chain" } zebra-state = { path = "../zebra-state" } +futures-util = "0.3.5" tower = "0.3.1" [dev-dependencies] diff --git a/zebra-consensus/src/verify.rs b/zebra-consensus/src/verify.rs index 3de706ed..5232f625 100644 --- a/zebra-consensus/src/verify.rs +++ b/zebra-consensus/src/verify.rs @@ -8,6 +8,7 @@ //! Verification is provided via a `tower::Service`, to support backpressure and batch //! verification. +use futures_util::FutureExt; use std::{ error, future::Future, @@ -80,7 +81,7 @@ where block: block.into(), }); - Box::pin(async move { Ok(header_hash) }) + async move { Ok(header_hash) }.boxed() } }