fix: clippy-redundant closures, fmt

This commit is contained in:
Henry de Valence 2020-09-10 10:52:51 -07:00
parent 0d6303a56f
commit 8fb0e11674
2 changed files with 8 additions and 10 deletions

View File

@ -265,8 +265,9 @@ async fn continuous_blockchain(restart_height: Option<block::Height>) -> Result<
/// SPANDOC: Verify blocks, restarting at {?restart_height} /// SPANDOC: Verify blocks, restarting at {?restart_height}
{ {
let initial_tip = restart_height let initial_tip = restart_height.map(|block::Height(height)| {
.map(|block::Height(height)| (blockchain[height as usize].1, blockchain[height as usize].2)); (blockchain[height as usize].1, blockchain[height as usize].2)
});
let state_service = zebra_state::init(zebra_state::Config::ephemeral(), Mainnet); let state_service = zebra_state::init(zebra_state::Config::ephemeral(), Mainnet);
let mut checkpoint_verifier = let mut checkpoint_verifier =
CheckpointVerifier::from_list(checkpoint_list, initial_tip, state_service.clone()) CheckpointVerifier::from_list(checkpoint_list, initial_tip, state_service.clone())

View File

@ -62,26 +62,23 @@ impl Service<Request> for StateService {
rsp_rx rsp_rx
.await .await
.expect("sender oneshot is not dropped") .expect("sender oneshot is not dropped")
.map(|hash| Response::Committed(hash)) .map(Response::Committed)
} }
.boxed() .boxed()
} }
Request::Depth(hash) => { Request::Depth(hash) => {
// todo: handle in memory and sled // todo: handle in memory and sled
self.sled self.sled.depth(hash).map_ok(Response::Depth).boxed()
.depth(hash)
.map_ok(|depth| Response::Depth(depth))
.boxed()
} }
Request::Tip => { Request::Tip => {
// todo: handle in memory and sled // todo: handle in memory and sled
self.sled.tip().map_ok(|tip| Response::Tip(tip)).boxed() self.sled.tip().map_ok(Response::Tip).boxed()
} }
Request::BlockLocator => { Request::BlockLocator => {
// todo: handle in memory and sled // todo: handle in memory and sled
self.sled self.sled
.block_locator() .block_locator()
.map_ok(|locator| Response::BlockLocator(locator)) .map_ok(Response::BlockLocator)
.boxed() .boxed()
} }
Request::Transaction(_) => unimplemented!(), Request::Transaction(_) => unimplemented!(),
@ -89,7 +86,7 @@ impl Service<Request> for StateService {
//todo: handle in memory and sled //todo: handle in memory and sled
self.sled self.sled
.block(hash_or_height) .block(hash_or_height)
.map_ok(|block| Response::Block(block)) .map_ok(Response::Block)
.boxed() .boxed()
} }
} }