cargo +nightly fmt

This commit is contained in:
Luke Parker
2023-08-01 00:47:36 -04:00
parent 88f88b574c
commit 3c38a0ec11
10 changed files with 40 additions and 40 deletions

View File

@@ -206,9 +206,10 @@ impl Serai {
}
let Some(finalized) =
self.0.rpc().header(Some(finalized)).await.map_err(SeraiError::RpcError)? else {
return Ok(None);
};
self.0.rpc().header(Some(finalized)).await.map_err(SeraiError::RpcError)?
else {
return Ok(None);
};
// If the finalized block has a lower number, this block can't be finalized
if finalized.number() < header.number() {
@@ -220,24 +221,20 @@ impl Serai {
// chain
// If that hash is this hash, this block is finalized
let Some(hash) =
self
.0
.rpc()
.block_hash(Some(header.number().into()))
.await
.map_err(SeraiError::RpcError)? else {
// This is an error since there is a block at this index
Err(SeraiError::InvalidNode)?
};
self.0.rpc().block_hash(Some(header.number().into())).await.map_err(SeraiError::RpcError)?
else {
// This is an error since there is a block at this index
Err(SeraiError::InvalidNode)?
};
Ok(Some(header.hash() == hash))
}
pub async fn get_block(&self, hash: [u8; 32]) -> Result<Option<Block>, SeraiError> {
let Some(res) =
self.0.rpc().block(Some(hash.into())).await.map_err(SeraiError::RpcError)? else {
return Ok(None);
};
let Some(res) = self.0.rpc().block(Some(hash.into())).await.map_err(SeraiError::RpcError)?
else {
return Ok(None);
};
// Only return finalized blocks
if self.is_finalized(&res.block.header).await? != Some(true) {
@@ -254,9 +251,10 @@ impl Serai {
// In practice, the block is likely more useful than the header
pub async fn get_block_by_number(&self, number: u64) -> Result<Option<Block>, SeraiError> {
let Some(hash) =
self.0.rpc().block_hash(Some(number.into())).await.map_err(SeraiError::RpcError)? else {
return Ok(None);
};
self.0.rpc().block_hash(Some(number.into())).await.map_err(SeraiError::RpcError)?
else {
return Ok(None);
};
self.get_block(hash.into()).await
}

View File

@@ -120,9 +120,7 @@ pub mod pallet {
Err(Error::AlreadyGeneratedKeys)?
}
let Some(musig_key) = MuSigKeys::<T>::get(set) else {
Err(Error::NonExistentValidatorSet)?
};
let Some(musig_key) = MuSigKeys::<T>::get(set) else { Err(Error::NonExistentValidatorSet)? };
if !musig_key.verify(&set_keys_message(&set, key_pair), signature) {
Err(Error::BadSignature)?;
}