X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fblinded_path%2Fmod.rs;h=29caafa4a4fc3ef61bf524de1469c4edaba89f5e;hb=bfff6fda6e2e6183285be59a999d5b74feb08779;hp=07fa7b770249cae94e1ea18269b63805dc933f93;hpb=59778dac488cff735004671cdefb3f4ac1f920fd;p=rust-lightning diff --git a/lightning/src/blinded_path/mod.rs b/lightning/src/blinded_path/mod.rs index 07fa7b77..29caafa4 100644 --- a/lightning/src/blinded_path/mod.rs +++ b/lightning/src/blinded_path/mod.rs @@ -14,6 +14,7 @@ pub(crate) mod message; pub(crate) mod utils; use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey}; +use core::ops::Deref; use crate::ln::msgs::DecodeError; use crate::offers::invoice::BlindedPayInfo; @@ -24,6 +25,17 @@ use crate::util::ser::{Readable, Writeable, Writer}; use crate::io; use crate::prelude::*; +/// The next hop to forward an onion message along its path. +/// +/// Note that payment blinded paths always specify their next hop using an explicit node id. +#[derive(Clone, Debug, Hash, PartialEq, Eq)] +pub enum NextMessageHop { + /// The node id of the next hop. + NodeId(PublicKey), + /// The short channel id leading to the next hop. + ShortChannelId(u64), +} + /// Onion messages and payments can be sent and received to blinded paths, which serve to hide the /// identity of the recipient. #[derive(Clone, Debug, Hash, PartialEq, Eq)] @@ -89,6 +101,11 @@ impl NodeIdLookUp for EmptyNodeIdLookUp { } } +impl Deref for EmptyNodeIdLookUp { + type Target = EmptyNodeIdLookUp; + fn deref(&self) -> &Self { self } +} + /// An encrypted payload and node id corresponding to a hop in a payment or onion message path, to /// be encoded in the sender's onion packet. These hops cannot be identified by outside observers /// and thus can be used to hide the identity of the recipient.