mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-12 19:15:48 +00:00
grandpa: fix warp sync proof on missing data (#8795)
* grandpa: check for missing data when iterating through authority set changes * grandpa-warp-sync: handle missing data
This commit is contained in:
@@ -173,4 +173,6 @@ pub enum HandleRequestError {
|
||||
InvalidProof(String),
|
||||
#[display(fmt = "Failed to send response.")]
|
||||
SendResponse,
|
||||
#[display(fmt = "Missing required data to be able to answer request.")]
|
||||
MissingData,
|
||||
}
|
||||
|
||||
@@ -91,7 +91,10 @@ impl<Block: BlockT> WarpSyncProof<Block> {
|
||||
let mut proofs_encoded_len = 0;
|
||||
let mut proof_limit_reached = false;
|
||||
|
||||
for (_, last_block) in set_changes.iter_from(begin_number) {
|
||||
let set_changes = set_changes.iter_from(begin_number)
|
||||
.ok_or(HandleRequestError::MissingData)?;
|
||||
|
||||
for (_, last_block) in set_changes {
|
||||
let header = blockchain.header(BlockId::Number(*last_block))?.expect(
|
||||
"header number comes from previously applied set changes; must exist in db; qed.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user