|
|
@ -62,14 +62,16 @@ impl MultisigCheckpointSyncer { |
|
|
|
// The highest viable checkpoint index is the minimum of the highest index
|
|
|
|
// The highest viable checkpoint index is the minimum of the highest index
|
|
|
|
// we (supposedly) have a quorum for, and the maximum index for which we can
|
|
|
|
// we (supposedly) have a quorum for, and the maximum index for which we can
|
|
|
|
// generate a proof.
|
|
|
|
// generate a proof.
|
|
|
|
let mut index = std::cmp::min(*highest_quorum_index, maximum_index); |
|
|
|
let start_index = highest_quorum_index.min(&maximum_index); |
|
|
|
while index >= minimum_index { |
|
|
|
if minimum_index > *start_index { |
|
|
|
|
|
|
|
return Ok(None); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for index in (minimum_index..=*start_index).rev() { |
|
|
|
if let Ok(Some(checkpoint)) = |
|
|
|
if let Ok(Some(checkpoint)) = |
|
|
|
self.fetch_checkpoint(index, validators, threshold).await |
|
|
|
self.fetch_checkpoint(index, validators, threshold).await |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Ok(Some(checkpoint)); |
|
|
|
return Ok(Some(checkpoint)); |
|
|
|
} |
|
|
|
} |
|
|
|
index -= 1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Ok(None) |
|
|
|
Ok(None) |
|
|
|