Skip to main content

decode_pix_offer

Function decode_pix_offer 

Source
fn decode_pix_offer(
    req: &StartInitiation<SessionTarget, HoprSessionCapabilities>,
) -> Result<Option<PixParams>, StartErrorReason>
Expand description

Decodes the incentivization the Entry offered, before anyone is asked what to do about it.

Ok(None) is a peer that offered none. Err is one whose offer this node cannot read or cannot share a curve with, which is refused on its own — no policy could rescue it, and both questions are cheaper than the round trip to the session server that follows.

Split out from SessionManager::check_pix_params so the session server can be told what was offered: it decides the terms, and terms relative to an offer need the offer.