Skip to content

Commit 40e5326

Browse files
Move NextMessageHop into blinded_path::message
It's only used for onion messages, not payments.
1 parent dc1e0e3 commit 40e5326

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
@@ -16,7 +16,7 @@ use crate::prelude::*;
1616

1717
use bitcoin::hashes::hmac::Hmac;
1818
use bitcoin::hashes::sha256::Hash as Sha256;
19-
use crate::blinded_path::{BlindedHop, BlindedPath, Direction, IntroductionNode, NextMessageHop, NodeIdLookUp};
19+
use crate::blinded_path::{BlindedHop, BlindedPath, Direction, IntroductionNode, NodeIdLookUp};
2020
use crate::blinded_path::utils;
2121
use crate::io;
2222
use crate::io::Cursor;
@@ -159,6 +159,17 @@ impl BlindedMessagePath {
159159
}
160160
}
161161

162+
/// The next hop to forward an onion message along its path.
163+
///
164+
/// Note that payment blinded paths always specify their next hop using an explicit node id.
165+
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
166+
pub enum NextMessageHop {
167+
/// The node id of the next hop.
168+
NodeId(PublicKey),
169+
/// The short channel id leading to the next hop.
170+
ShortChannelId(u64),
171+
}
172+
162173
/// An intermediate node, and possibly a short channel id leading to the next node.
163174
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
164175
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)