Skip to main content

Module ack_verify

Module ack_verify 

Source
Expand description

Common acknowledgement verification helper shared by acknowledgement processors.

Both the acknowledge_shares method on crate::ExitAcknowledgementShareProcessor and the HoprUnacknowledgedTicketProcessor::acknowledge_tickets over in hopr-protocol-hopr need to perform the very same steps when an incoming batch of [Acknowledgement]s arrives from a peer:

  1. Check that some state is awaited from the given peer (i.e. that the local awaiting-acks cache contains the peer entry) without bumping its popularity estimator so that the entry can be evicted normally on inactivity.
  2. Verify all acknowledgements (using either per-acknowledgement verification or the more efficient batch verification algorithm) and translate the resulting half-keys to their challenges.

The post-processing of the verified acknowledgements is specific to each caller and is therefore left out of this helper.

Functionsยง

verify_expected_acknowledgements
Checks whether an acknowledgement from peer is currently expected (by looking at the awaiting_acks cache) and, if so, verifies all incoming acks.