anvil::config

Function find_latest_fork_block

Source
async fn find_latest_fork_block<P: Provider<T, AnyNetwork>, T: Transport + Clone>(
    provider: P,
) -> Result<u64, TransportError>
Expand description

Finds the latest appropriate block to fork

This fetches the “latest” block and checks whether the Block is fully populated (hash field is present). This prevents edge cases where anvil forks the “latest” block but eth_getBlockByNumber still returns a pending block, https://github.com/foundry-rs/foundry/issues/2036