mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 13:51:11 +00:00
Add an is_finished boolean to the grandpa warp sync response (#8203)
This commit is contained in:
@@ -46,6 +46,7 @@ pub struct AuthoritySetChangeProof<Block: BlockT> {
|
|||||||
#[derive(Decode, Encode)]
|
#[derive(Decode, Encode)]
|
||||||
pub struct WarpSyncProof<Block: BlockT> {
|
pub struct WarpSyncProof<Block: BlockT> {
|
||||||
proofs: Vec<AuthoritySetChangeProof<Block>>,
|
proofs: Vec<AuthoritySetChangeProof<Block>>,
|
||||||
|
is_finished: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Block: BlockT> WarpSyncProof<Block> {
|
impl<Block: BlockT> WarpSyncProof<Block> {
|
||||||
@@ -86,8 +87,11 @@ impl<Block: BlockT> WarpSyncProof<Block> {
|
|||||||
|
|
||||||
let mut proofs = Vec::new();
|
let mut proofs = Vec::new();
|
||||||
|
|
||||||
|
let mut proof_limit_reached = false;
|
||||||
|
|
||||||
for (_, last_block) in set_changes.iter_from(begin_number) {
|
for (_, last_block) in set_changes.iter_from(begin_number) {
|
||||||
if proofs.len() >= MAX_CHANGES_PER_WARP_SYNC_PROOF {
|
if proofs.len() >= MAX_CHANGES_PER_WARP_SYNC_PROOF {
|
||||||
|
proof_limit_reached = true;
|
||||||
break;
|
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.
|
/// Verifies the warp sync proof starting at the given set id and with the given authorities.
|
||||||
|
|||||||
Reference in New Issue
Block a user