mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
do not call best_finalized_para_block_at_source for ancient block (#1819)
This commit is contained in:
committed by
Bastian Köcher
parent
c8c606dd66
commit
804ab654bc
@@ -674,10 +674,19 @@ where
|
|||||||
required_parachain_header.unique_saturated_into(),
|
required_parachain_header.unique_saturated_into(),
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
|
// we don't require source node to be archive, so we can't craft storage proofs using
|
||||||
|
// ancient headers. So if the `best_finalized_relay_block_at_target` is too ancient, we
|
||||||
|
// can't craft storage proofs using it
|
||||||
|
let may_use_state_at_best_finalized_relay_block_at_target =
|
||||||
|
best_finalized_relay_block_at_source
|
||||||
|
.number()
|
||||||
|
.saturating_sub(best_finalized_relay_block_at_target.number()) <=
|
||||||
|
RBN::from(ANCIENT_BLOCK_THRESHOLD);
|
||||||
|
|
||||||
// now let's check if `required_header` may be proved using
|
// now let's check if `required_header` may be proved using
|
||||||
// `best_finalized_relay_block_at_target`
|
// `best_finalized_relay_block_at_target`
|
||||||
let selection = env
|
let selection = if may_use_state_at_best_finalized_relay_block_at_target {
|
||||||
.best_finalized_para_block_at_source(best_finalized_relay_block_at_target)
|
env.best_finalized_para_block_at_source(best_finalized_relay_block_at_target)
|
||||||
.await?
|
.await?
|
||||||
.filter(|best_finalized_para_block_at_target| {
|
.filter(|best_finalized_para_block_at_target| {
|
||||||
best_finalized_para_block_at_target.number() >= required_parachain_header
|
best_finalized_para_block_at_target.number() >= required_parachain_header
|
||||||
@@ -685,15 +694,9 @@ where
|
|||||||
.map(|best_finalized_para_block_at_target| {
|
.map(|best_finalized_para_block_at_target| {
|
||||||
(false, best_finalized_relay_block_at_target, best_finalized_para_block_at_target)
|
(false, best_finalized_relay_block_at_target, best_finalized_para_block_at_target)
|
||||||
})
|
})
|
||||||
// we don't require source node to be archive, so we can't craft storage proofs using
|
} else {
|
||||||
// ancient headers. So if the `best_finalized_relay_block_at_target` is too ancient, we
|
None
|
||||||
// can't craft storage proofs using it
|
};
|
||||||
.filter(|(_, selected_relay_block, _)| {
|
|
||||||
let difference = best_finalized_relay_block_at_source
|
|
||||||
.number()
|
|
||||||
.saturating_sub(selected_relay_block.number());
|
|
||||||
difference <= RBN::from(ANCIENT_BLOCK_THRESHOLD)
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(selection.unwrap_or((
|
Ok(selection.unwrap_or((
|
||||||
true,
|
true,
|
||||||
|
|||||||
Reference in New Issue
Block a user