pub fn verify_expected_acknowledgements<V>(
peer: OffchainPublicKey,
acks: Vec<Acknowledgement>,
awaiting_acks: &Cache<OffchainPublicKey, V>,
use_batch_verification: bool,
) -> Option<(V, Vec<(HalfKey, HalfKeyChallenge)>)>Expand description
Checks whether an acknowledgement from peer is currently expected (by looking at the
awaiting_acks cache) and, if so, verifies all incoming acks.
The lookup is performed in two steps so that the popularity estimator of the
peer entry inside awaiting_acks is not bumped on the initial existence check,
allowing the entry to time out naturally on inactivity.
When use_batch_verification is true, [Acknowledgement::verify_batch] is used,
which transparently falls back to per-acknowledgement verification for small batches
and switches to the more effective batch verification algorithm for larger ones.
Otherwise, each acknowledgement is verified individually.
Returns the cloned per-peer cache entry alongside the verified (half-key, challenge)
pairs, or None if no acknowledgement is expected from peer.
Invalid acknowledgements are logged and silently dropped.