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}
{
let initial_tip = restart_height
.map(|block::Height(height)| (blockchain[height as usize].1, blockchain[height as usize].2));
let initial_tip = restart_height.map(|block::Height(height)| {
(blockchain[height as usize].1, blockchain[height as usize].2)
});
let state_service = zebra_state::init(zebra_state::Config::ephemeral(), Mainnet);
let mut checkpoint_verifier =
CheckpointVerifier::from_list(checkpoint_list, initial_tip, state_service.clone())

View File

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