Skip to content

Commit 5d895a5

Browse files
Move NextMessageHop into blinded_path::message
It's only used for onion messages, not payments.
1 parent 0aef290 commit 5d895a5

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

lightning/src/blinded_path/message.rs

Lines changed: 13 additions & 1 deletion
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;
@@ -113,6 +113,18 @@ impl BlindedMessagePath {
113113
}
114114
}
115115

116+
/// The next hop to forward an onion message along its path.
117+
///
118+
/// Note that payment blinded paths always specify their next hop using an explicit node id.
119+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
120+
pub enum NextMessageHop {
121+
/// The node id of the next hop.
122+
NodeId(PublicKey),
123+
/// The short channel id leading to the next hop.
124+
ShortChannelId(u64),
125+
}
126+
127+
116128
/// An intermediate node, and possibly a short channel id leading to the next node.
117129
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
118130
pub struct ForwardNode {

lightning/src/blinded_path/mod.rs

Lines changed: 0 additions & 11 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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)