Skip to content

Commit 3202225

Browse files
Move NextMessageHop into blinded_path::message
It's only used for onion messages, not payments.
1 parent 5387eb6 commit 3202225

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

lightning/src/blinded_path/message.rs

+12-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, Direction, IntroductionNode, NextMessageHop, NodeIdLookUp};
17+
use crate::blinded_path::{BlindedHop, BlindedPath, Direction, IntroductionNode, NodeIdLookUp};
1818
use crate::blinded_path::utils;
1919
use crate::io;
2020
use crate::io::Cursor;
@@ -157,6 +157,17 @@ impl BlindedMessagePath {
157157
}
158158
}
159159

160+
/// The next hop to forward an onion message along its path.
161+
///
162+
/// Note that payment blinded paths always specify their next hop using an explicit node id.
163+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
164+
pub enum NextMessageHop {
165+
/// The node id of the next hop.
166+
NodeId(PublicKey),
167+
/// The short channel id leading to the next hop.
168+
ShortChannelId(u64),
169+
}
170+
160171
/// An intermediate node, and possibly a short channel id leading to the next node.
161172
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
162173
pub struct ForwardNode {

lightning/src/blinded_path/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ use crate::util::ser::{Readable, Writeable, Writer};
2323
use crate::io;
2424
use crate::prelude::*;
2525

26-
/// The next hop to forward an onion message along its path.
27-
///
28-
/// Note that payment blinded paths always specify their next hop using an explicit node id.
29-
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
30-
pub enum NextMessageHop {
31-
/// The node id of the next hop.
32-
NodeId(PublicKey),
33-
/// The short channel id leading to the next hop.
34-
ShortChannelId(u64),
35-
}
36-
3726
/// Onion messages and payments can be sent and received to blinded paths, which serve to hide the
3827
/// identity of the recipient.
3928
#[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::{IntroductionNode, NextMessageHop, NodeIdLookUp};
19-
use crate::blinded_path::message::{advance_path_by_one, BlindedMessagePath, ForwardNode, ForwardTlvs, MessageContext, ReceiveTlvs};
18+
use crate::blinded_path::{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)