pub async fn determine_new_blocks<E, Sender>(
sender: &mut Sender,
is_known: impl Fn(&Hash) -> Result<bool, E>,
head: Hash,
header: &Header,
lower_bound_number: BlockNumber,
) -> Result<Vec<(Hash, Header)>, E>where
Sender: SubsystemSender<ChainApiMessage>,
Expand description
Given a new chain-head hash, this determines the hashes of all new blocks we should track metadata for, given this head.
This is guaranteed to be a subset of the (inclusive) ancestry of head
determined as all
blocks above the lower bound or above the highest known block, whichever is higher.
This is formatted in descending order by block height.
An implication of this is that if head
itself is known or not above the lower bound,
then the returned list will be empty.
This may be somewhat expensive when first recovering from major sync.