service.rs

Overview

This file implements the block validation service within the system. Its primary responsibility is to manage the lifecycle of the validation process that handles block states and their validation envelopes. It provides an interface for sending blocks to be validated asynchronously, and it manages a dedicated thread that executes the validation logic.

The validation service interacts closely with various components such as the blockchain repository, configuration, shared services, block state repository, message durable storage, and authority management. It orchestrates the flow of block validation messages and ensures the validation process operates continuously without unexpected termination unless the system is deliberately shutting down.


Structures and Their Functionalities

ValidationServiceInterface

A lightweight, clonable interface that exposes a method to send block states coupled with their corresponding validation envelopes to the validation service's internal message channel.

Fields

Methods


ValidationService

Manages the background thread that runs the validation process and provides access to its sending interface.

Fields

Methods


Important Implementation Details


Interaction with Other System Components


Mermaid Class Diagram

classDiagram
class ValidationServiceInterface {
+send(state)
}
class ValidationService {
+interface()
+new()
}
ValidationService "1" o-- "1" ValidationServiceInterface : has
ValidationService ..> std::thread::JoinHandle : owns

This diagram illustrates the composition relationship where ValidationService owns an instance of ValidationServiceInterface and a thread handle. The interface provides a method to send block states for validation, while the service manages the lifecycle and execution thread.