mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 11:41:04 +00:00
Merge pull request #39 from paritytech/bkchr-safety-violation
Don't finalize the same block multiple times
This commit is contained in:
@@ -131,12 +131,17 @@ where
|
|||||||
type Block = Block;
|
type Block = Block;
|
||||||
|
|
||||||
fn finalize(&self, hash: <Self::Block as BlockT>::Hash) -> ClientResult<bool> {
|
fn finalize(&self, hash: <Self::Block as BlockT>::Hash) -> ClientResult<bool> {
|
||||||
match self.finalize_block(BlockId::hash(hash), None, true) {
|
// don't finalize the same block multiple times.
|
||||||
Ok(()) => Ok(true),
|
if self.chain_info().finalized_hash != hash {
|
||||||
Err(e) => match e {
|
match self.finalize_block(BlockId::hash(hash), None, true) {
|
||||||
ClientError::UnknownBlock(_) => Ok(false),
|
Ok(()) => Ok(true),
|
||||||
_ => Err(e),
|
Err(e) => match e {
|
||||||
},
|
ClientError::UnknownBlock(_) => Ok(false),
|
||||||
|
_ => Err(e),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Ok(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user