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:
- Fetches the parent hash of the latest block from the API.
- Determines the current period index.
- Retrieves the evaluation pool for the current period.
- If the pool does not exist or is empty, it returns
None
.
- If the pool does not exist or is empty, it returns
- 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
.
- If it exists, the task has already been completed, so the function returns
- Ensures the evaluation result directory is available, creating it if necessary.
- Retrieves the block number of the evaluation.