Merge pull request #39 from paritytech/bkchr-safety-violation

Don't finalize the same block multiple times
This commit is contained in:
Bastian Köcher
2020-01-16 08:43:53 +01:00
committed by GitHub
+5
View File
@@ -131,6 +131,8 @@ 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> {
// don't finalize the same block multiple times.
if self.chain_info().finalized_hash != hash {
match self.finalize_block(BlockId::hash(hash), None, true) { match self.finalize_block(BlockId::hash(hash), None, true) {
Ok(()) => Ok(true), Ok(()) => Ok(true),
Err(e) => match e { Err(e) => match e {
@@ -138,6 +140,9 @@ where
_ => Err(e), _ => Err(e),
}, },
} }
} else {
Ok(true)
}
} }
} }