pub trait UnacknowledgedTicketProcessor {
type Error: Error + Send + Sync + 'static;
// Required methods
fn insert_unacknowledged_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
next_hop: &'life1 OffchainPublicKey,
challenge: HalfKeyChallenge,
ticket: UnacknowledgedTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn acknowledge_tickets<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
acks: Vec<Acknowledgement>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResolvedAcknowledgement>, TicketAcknowledgementError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Performs necessary processing of unacknowledged tickets in the HOPR packet processing pipeline.
Required Associated Types§
Required Methods§
Sourcefn insert_unacknowledged_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
next_hop: &'life1 OffchainPublicKey,
challenge: HalfKeyChallenge,
ticket: UnacknowledgedTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn insert_unacknowledged_ticket<'life0, 'life1, 'async_trait>(
&'life0 self,
next_hop: &'life1 OffchainPublicKey,
challenge: HalfKeyChallenge,
ticket: UnacknowledgedTicket,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Inserts a verified unacknowledged ticket from a delivered packet into the internal storage.
The ticket corresponds to the given challenge
and awaits to be acknowledged
once an Acknowledgement is received from the next_hop.
Sourcefn acknowledge_tickets<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
acks: Vec<Acknowledgement>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResolvedAcknowledgement>, TicketAcknowledgementError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acknowledge_tickets<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
acks: Vec<Acknowledgement>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResolvedAcknowledgement>, TicketAcknowledgementError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Finds and acknowledges previously inserted tickets, using incoming Acknowledgements from
the upstream peer.
Function should first check if any acknowledgements are expected from the given peer.
Furthermore, the function must verify each given acknowledgement and find if it evaluates to any solutions to challenges of previously inserted tickets.
On success, the resolutions contain decisions whether the previously stored ticket with a matching challenge was found, and whether it is winning (and thus also redeemable) or losing. Challenges for which tickets were not found are skipped.
Must return TicketAcknowledgementError::UnexpectedAcknowledgement if no Acknowledgements from the given
peer was expected.