Skip to content

Commit b6497a2

Browse files
Move NextMessageHop into blinded_path::message
It's only used for onion messages, not payments.
1 parent 6d7a99f commit b6497a2

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

lightning/src/blinded_path/message.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey};
1414
#[allow(unused_imports)]
1515
use crate::prelude::*;
1616

17-
use crate::blinded_path::{BlindedHop, BlindedPath, IntroductionNode, NextMessageHop, NodeIdLookUp};
17+
use crate::blinded_path::{BlindedHop, BlindedPath, IntroductionNode, NodeIdLookUp};
1818
use crate::blinded_path::utils;
1919
use crate::io;
2020
use crate::io::Cursor;
@@ -74,6 +74,18 @@ impl BlindedMessagePath {
7474
}
7575
}
7676

77+
/// The next hop to forward an onion message along its path.
78+
///
79+
/// Note that payment blinded paths always specify their next hop using an explicit node id.
80+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
81+
pub enum NextMessageHop {
82+
/// The node id of the next hop.
83+
NodeId(PublicKey),
84+
/// The short channel id leading to the next hop.
85+
ShortChannelId(u64),
86+
}
87+
88+
7789
/// An intermediate node, and possibly a short channel id leading to the next node.
7890
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
7991
pub struct ForwardNode {

lightning/src/blinded_path/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,6 @@ use crate::util::scid_utils;
2424
use crate::io;
2525
use crate::prelude::*;
2626

27-
/// The next hop to forward an onion message along its path.
28-
///
29-
/// Note that payment blinded paths always specify their next hop using an explicit node id.
30-
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
31-
pub enum NextMessageHop {
32-
/// The node id of the next hop.
33-
NodeId(PublicKey),
34-
/// The short channel id leading to the next hop.
35-
ShortChannelId(u64),
36-
}
37-
3827
/// Onion messages and payments can be sent and received to blinded paths, which serve to hide the
3928
/// identity of the recipient.
4029
#[derive(Clone, Debug, Hash, PartialEq, Eq)]

lightning/src/onion_message/messenger.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use bitcoin::hashes::hmac::{Hmac, HmacEngine};
1515
use bitcoin::hashes::sha256::Hash as Sha256;
1616
use bitcoin::secp256k1::{self, PublicKey, Scalar, Secp256k1, SecretKey};
1717

18-
use crate::blinded_path::{BlindedPath, IntroductionNode, NextMessageHop, NodeIdLookUp};
19-
use crate::blinded_path::message::{advance_path_by_one, BlindedMessagePath, ForwardNode, ForwardTlvs, MessageContext, ReceiveTlvs};
18+
use crate::blinded_path::{BlindedPath, IntroductionNode, NodeIdLookUp};
19+
use crate::blinded_path::message::{advance_path_by_one, BlindedMessagePath, ForwardNode, ForwardTlvs, MessageContext, NextMessageHop, ReceiveTlvs};
2020
use crate::blinded_path::utils;
2121
use crate::events::{Event, EventHandler, EventsProvider, ReplayEvent};
2222
use crate::sign::{EntropySource, NodeSigner, Recipient};

lightning/src/onion_message/packet.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
use bitcoin::secp256k1::PublicKey;
1313
use bitcoin::secp256k1::ecdh::SharedSecret;
1414

15-
use crate::blinded_path::NextMessageHop;
16-
use crate::blinded_path::message::{BlindedMessagePath, ForwardTlvs, ReceiveTlvs};
15+
use crate::blinded_path::message::{BlindedMessagePath, ForwardTlvs, NextMessageHop, ReceiveTlvs};
1716
use crate::blinded_path::utils::Padding;
1817
use crate::ln::msgs::DecodeError;
1918
use crate::ln::onion_utils;

0 commit comments

Comments
 (0)