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_ticket<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
ack: Acknowledgement,
) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedAcknowledgement>, 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_ticket<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
ack: Acknowledgement,
) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedAcknowledgement>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acknowledge_ticket<'life0, 'async_trait>(
&'life0 self,
peer: OffchainPublicKey,
ack: Acknowledgement,
) -> Pin<Box<dyn Future<Output = Result<Option<ResolvedAcknowledgement>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Finds and acknowledges previously inserted ticket, using an Acknowledgement from the
upstream peer.
This function must verify the given acknowledgement and find if it contains a solution to a challenge of a previously inserted ticket.
On success, the resolution contains a decision whether the corresponding previously stored ticket was found, and whether it is winning (and thus also redeemable) or losing.
Returns Ok(None) if no Acknowledgement from peer was
expected.
Returns an error if acknowledgement was expected from peer, but a ticket with the challenge
corresponding to the Acknowledgement was not found.