pub trait TicketTracker {
type Error: Error + Send + Sync + 'static;
// Required methods
fn next_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn incoming_channel_unrealized_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn create_multihop_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelEntry,
current_path_pos: u8,
winning_prob: WinningProbability,
ticket_price: HoprBalance,
) -> Pin<Box<dyn Future<Output = Result<TicketBuilder, TicketCreationError<Self::Error>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Allows tracking ticket indices of outgoing channels and unrealized balances of incoming channels.
Required Associated Types§
Required Methods§
Sourcefn next_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn next_outgoing_ticket_index<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<u64, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets the next ticket index for an outgoing ticket for the given channel.
Sourcefn incoming_channel_unrealized_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn incoming_channel_unrealized_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_id: &'life1 ChannelId,
epoch: u32,
) -> Pin<Box<dyn Future<Output = Result<HoprBalance, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the unrealized balance of the given channel.
This allows guarding from situations where the ticket issuer issues more tickets than there’s balance in the given channel.
Provided Methods§
Sourcefn create_multihop_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelEntry,
current_path_pos: u8,
winning_prob: WinningProbability,
ticket_price: HoprBalance,
) -> Pin<Box<dyn Future<Output = Result<TicketBuilder, TicketCreationError<Self::Error>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_multihop_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
channel: &'life1 ChannelEntry,
current_path_pos: u8,
winning_prob: WinningProbability,
ticket_price: HoprBalance,
) -> Pin<Box<dyn Future<Output = Result<TicketBuilder, TicketCreationError<Self::Error>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Convenience function that allows creating multi-hop tickets.