pub async fn find_potential_parents<B: BlockT>(
params: ParentSearchParams,
backend: &impl Backend<B>,
relay_client: &impl RelayChainInterface,
) -> Result<Vec<PotentialParent<B>>, RelayChainError>
Expand description
Perform a recursive search through blocks to find potential parent blocks for a new block.
This accepts a relay-chain block to be used as an anchor and a maximum search depth,
along with some arguments for filtering parachain blocks and performs a recursive search
for parachain blocks. The search begins at the last included parachain block and returns
a set of PotentialParent
s which could be potential parents of a new block with this
relay-parent according to the search parameters.
A parachain block is a potential parent if it is either the last included parachain block, the
pending parachain block (when max_depth
>= 1), or all of the following hold:
- its parent is a potential parent
- its relay-parent is within
ancestry_lookback
of the targeted relay-parent. - its relay-parent is within the same session as the targeted relay-parent.
- the block number is within
max_depth
blocks of the included block