Function distance_oracle::prepare_evaluation_context

source ยท
pub(crate) async fn prepare_evaluation_context(
    client: &Client,
    settings: &Settings,
) -> Option<(H256, u32, EvaluationPool, PathBuf)>
Expand description

Prepares the context for the next evaluation task.

This function performs the following steps:

  1. Fetches the parent hash of the latest block from the API.
  2. Determines the current period index.
  3. Retrieves the evaluation pool for the current period.
    • If the pool does not exist or is empty, it returns None.
  4. Checks if the evaluation result file for the next period already exists.
    • If it exists, the task has already been completed, so the function returns None.
  5. Ensures the evaluation result directory is available, creating it if necessary.
  6. Retrieves the block number of the evaluation.