Commit 87ab9f9b authored by Yuanchao Sun's avatar Yuanchao Sun Committed by asynchronous rob
Browse files

Fix fetch_candidates (#330)

fix the following error in the log:
Could not extract candidates from block body of imported block ...
parent c5836f3e
Pipeline #44111 passed with stages
in 16 minutes and 59 seconds
......@@ -54,15 +54,19 @@ pub(crate) fn fetch_candidates<P: BlockBody<Block>>(client: &P, block: &BlockId)
use polkadot_runtime::{Call, ParachainsCall, UncheckedExtrinsic as RuntimeExtrinsic};
let extrinsics = client.block_body(block)?;
Ok(extrinsics
.into_iter()
.filter_map(|ex| RuntimeExtrinsic::decode(&mut ex.encode().as_slice()))
.filter_map(|ex| match ex.function {
Call::Parachains(ParachainsCall::set_heads(heads)) =>
Some(heads.into_iter().map(|c| c.candidate)),
_ => None,
})
.next())
Ok(match extrinsics {
Some(extrinsics) => extrinsics
.into_iter()
.filter_map(|ex| RuntimeExtrinsic::decode(&mut ex.encode().as_slice()))
.filter_map(|ex| match ex.function {
Call::Parachains(ParachainsCall::set_heads(heads)) => {
Some(heads.into_iter().map(|c| c.candidate))
}
_ => None,
})
.next(),
None => None,
})
}
// creates a task to prune redundant entries in availability store upon block finalization
......
Supports Markdown
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