mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-12 09:26:51 +00:00
Correct panic possible when jumping to a round with Precommit(None)
This commit is contained in:
parent
9accddb2d7
commit
041ed46171
1 changed files with 4 additions and 2 deletions
|
@ -544,7 +544,8 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||
}
|
||||
}
|
||||
|
||||
// Returns Ok(true) if this was a Precommit which had its signature validated
|
||||
// Returns Ok(true) if this was a Precommit which had either no signature or its signature
|
||||
// validated
|
||||
// Returns Ok(false) if it wasn't a Precommit or the signature wasn't validated yet
|
||||
// Returns Err if the signature was invalid
|
||||
fn verify_precommit_signature(
|
||||
|
@ -552,7 +553,8 @@ impl<N: Network + 'static> TendermintMachine<N> {
|
|||
signed: &SignedMessageFor<N>,
|
||||
) -> Result<bool, TendermintError<N>> {
|
||||
let msg = &signed.msg;
|
||||
if let Data::Precommit(Some((id, sig))) = &msg.data {
|
||||
if let Data::Precommit(precommit) = &msg.data {
|
||||
let Some((id, sig)) = precommit else { return Ok(true) };
|
||||
// Also verify the end_time of the commit
|
||||
// Only perform this verification if we already have the end_time
|
||||
// Else, there's a DoS where we receive a precommit for some round infinitely in the future
|
||||
|
|
Loading…
Reference in a new issue