Skip to content

Commit

Permalink
Move NextMessageHop into blinded_path::message
Browse files Browse the repository at this point in the history
It's only used for onion messages, not payments.
  • Loading branch information
valentinewallace committed Aug 9, 2024
1 parent 6d7a99f commit b6497a2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
14 changes: 13 additions & 1 deletion lightning/src/blinded_path/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey};
#[allow(unused_imports)]
use crate::prelude::*;

use crate::blinded_path::{BlindedHop, BlindedPath, IntroductionNode, NextMessageHop, NodeIdLookUp};
use crate::blinded_path::{BlindedHop, BlindedPath, IntroductionNode, NodeIdLookUp};
use crate::blinded_path::utils;
use crate::io;
use crate::io::Cursor;
Expand Down Expand Up @@ -74,6 +74,18 @@ impl BlindedMessagePath {
}
}

/// 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),
}


/// An intermediate node, and possibly a short channel id leading to the next node.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub struct ForwardNode {
Expand Down
11 changes: 0 additions & 11 deletions lightning/src/blinded_path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ use crate::util::scid_utils;
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)]
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/onion_message/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use bitcoin::hashes::hmac::{Hmac, HmacEngine};
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::secp256k1::{self, PublicKey, Scalar, Secp256k1, SecretKey};

use crate::blinded_path::{BlindedPath, IntroductionNode, NextMessageHop, NodeIdLookUp};
use crate::blinded_path::message::{advance_path_by_one, BlindedMessagePath, ForwardNode, ForwardTlvs, MessageContext, ReceiveTlvs};
use crate::blinded_path::{BlindedPath, IntroductionNode, NodeIdLookUp};
use crate::blinded_path::message::{advance_path_by_one, BlindedMessagePath, ForwardNode, ForwardTlvs, MessageContext, NextMessageHop, ReceiveTlvs};
use crate::blinded_path::utils;
use crate::events::{Event, EventHandler, EventsProvider, ReplayEvent};
use crate::sign::{EntropySource, NodeSigner, Recipient};
Expand Down
3 changes: 1 addition & 2 deletions lightning/src/onion_message/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
use bitcoin::secp256k1::PublicKey;
use bitcoin::secp256k1::ecdh::SharedSecret;

use crate::blinded_path::NextMessageHop;
use crate::blinded_path::message::{BlindedMessagePath, ForwardTlvs, ReceiveTlvs};
use crate::blinded_path::message::{BlindedMessagePath, ForwardTlvs, NextMessageHop, ReceiveTlvs};
use crate::blinded_path::utils::Padding;
use crate::ln::msgs::DecodeError;
use crate::ln::onion_utils;
Expand Down

0 comments on commit b6497a2

Please sign in to comment.