Trait ChainReadTicketOperations
pub trait ChainReadTicketOperations {
type Error: Error + Send + Sync + 'static;
// Required method
fn incoming_ticket_values(
&self,
) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>;
// Provided method
fn outgoing_ticket_values(
&self,
configured_wp: Option<WinningProbability>,
configured_price: Option<Balance<WxHOPR>>,
) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error> { ... }
}Expand description
On-chain operations to read values related to tickets.
These operations are used in critical packet processing pipelines, and therefore, should not query the chain information directly, and they MUST NOT block.
Required Associated Types§
Required Methods§
fn incoming_ticket_values(
&self,
) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>
fn incoming_ticket_values( &self, ) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>
Retrieves the expected minimum winning probability and ticket price for incoming tickets.
This operation MUST not block, as it is typically used within the critical packet processing pipeline.
Provided Methods§
fn outgoing_ticket_values(
&self,
configured_wp: Option<WinningProbability>,
configured_price: Option<Balance<WxHOPR>>,
) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>
fn outgoing_ticket_values( &self, configured_wp: Option<WinningProbability>, configured_price: Option<Balance<WxHOPR>>, ) -> Result<(WinningProbability, Balance<WxHOPR>), Self::Error>
Retrieves the winning probability and ticket price for outgoing tickets, with respect to the optionally pre-configured values.
The caller, not the implementation, should make sure that the configured values (if provided) are not less than the expected values for incoming tickets.
This operation MUST not block, as it is typically used within the critical packet processing pipeline.
The default implementation calls the incoming_ticket_values method and uses the incoming values
unless the configured values are provided.