Skip to content
Snippets Groups Projects
Commit 241302d0 authored by Ashley's avatar Ashley Committed by GitHub
Browse files

Add an is_finished boolean to the grandpa warp sync response (#8203)

parent 5232e8ad
No related merge requests found
......@@ -46,6 +46,7 @@ pub struct AuthoritySetChangeProof<Block: BlockT> {
#[derive(Decode, Encode)]
pub struct WarpSyncProof<Block: BlockT> {
proofs: Vec<AuthoritySetChangeProof<Block>>,
is_finished: bool,
}
impl<Block: BlockT> WarpSyncProof<Block> {
......@@ -86,8 +87,11 @@ impl<Block: BlockT> WarpSyncProof<Block> {
let mut proofs = Vec::new();
let mut proof_limit_reached = false;
for (_, last_block) in set_changes.iter_from(begin_number) {
if proofs.len() >= MAX_CHANGES_PER_WARP_SYNC_PROOF {
proof_limit_reached = true;
break;
}
......@@ -118,7 +122,10 @@ impl<Block: BlockT> WarpSyncProof<Block> {
});
}
Ok(WarpSyncProof { proofs })
Ok(WarpSyncProof {
proofs,
is_finished: !proof_limit_reached,
})
}
/// Verifies the warp sync proof starting at the given set id and with the given authorities.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment