-/// An input used when decoding an onion packet.
-pub(crate) trait DecodeInput {
- type Arg;
- /// If Some, this is the input when checking the hmac of the onion packet.
- fn payment_hash(&self) -> Option<&PaymentHash>;
- /// Read argument when decrypting our hop payload.
- fn read_arg(self) -> Self::Arg;
-}
-
-impl DecodeInput for PaymentHash {
- type Arg = ();
- fn payment_hash(&self) -> Option<&PaymentHash> {
- Some(self)
- }
- fn read_arg(self) -> Self::Arg { () }
-}
-
-impl DecodeInput for SharedSecret {
- type Arg = SharedSecret;
- fn payment_hash(&self) -> Option<&PaymentHash> {
- None
- }
- fn read_arg(self) -> Self::Arg { self }
-}
-