Fix relay submitting extra parachain headers during reorg (#2839)

* fix on-demand parachain relay behavior during target chain reorgs

* fix compilation
This commit is contained in:
Svyatoslav Nikolsky
2024-02-16 11:07:03 +03:00
committed by Bastian Köcher
parent acfd2847b4
commit f24e8f008a
2 changed files with 44 additions and 8 deletions
@@ -120,10 +120,15 @@ where
// `max_header_id` is not set. There is no limit.
AvailableHeader::Available(on_chain_para_head_id)
},
AvailableHeader::Available(max_head_id) => {
AvailableHeader::Available(max_head_id) if on_chain_para_head_id >= max_head_id => {
// We report at most `max_header_id`.
AvailableHeader::Available(std::cmp::min(on_chain_para_head_id, max_head_id))
},
AvailableHeader::Available(_) => {
// the `max_head_id` is not yet available at the source chain => wait and avoid
// syncing extra headers
AvailableHeader::Unavailable
},
}
}