Skip to content

Commit c33c95b

Browse files
committed
f move struct to oubound_payments
1 parent 1ae9975 commit c33c95b

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use core::time::Duration;
7777
use core::ops::Deref;
7878

7979
// Re-export this for use in the public API.
80-
pub use crate::ln::outbound_payment::{PaymentSendFailure, Retry, RetryableSendFailure};
80+
pub use crate::ln::outbound_payment::{PaymentSendFailure, Retry, RetryableSendFailure, RecipientOnionFields};
8181

8282
// We hold various information about HTLC relay in the HTLC objects in Channel itself:
8383
//
@@ -226,38 +226,6 @@ impl Readable for PaymentId {
226226
}
227227
}
228228

229-
/// Information which is provided, encrypted, to the payment recipient when sending HTLCs.
230-
///
231-
/// This should generally be constructed with data communicated to us from the recipient (via some
232-
/// form of invoice).
233-
#[derive(Clone)]
234-
pub struct RecipientOnionFields {
235-
/// The [`PaymentSecret`] which is an arbitrary 32 bytes provided by the recipient for us to
236-
/// repeat in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists
237-
/// to authenticate the sender to the recipient and prevent payment-probing (deanonymization)
238-
/// attacks.
239-
///
240-
/// If you do not have one, the [`Route`] you pay over must not contain multiple paths as
241-
/// multi-path payments require a recipient-provided secret.
242-
pub payment_secret: Option<PaymentSecret>,
243-
}
244-
245-
impl RecipientOnionFields {
246-
/// Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common
247-
/// set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`]
248-
/// but do not require or provide any further data.
249-
pub fn secret_only(payment_secret: PaymentSecret) -> Self {
250-
Self { payment_secret: Some(payment_secret) }
251-
}
252-
253-
/// Creates a new [`RecipientOnionFields`] with no fields. This generally does not create
254-
/// payable HTLCs except for spontaneous payments, i.e. this should generally only be used for
255-
/// calls to [`ChannelManager::send_spontaneous_payment`].
256-
pub fn spontaneous_empty() -> Self {
257-
Self { payment_secret: None }
258-
}
259-
}
260-
261229
/// An identifier used to uniquely identify an intercepted HTLC to LDK.
262230
///
263231
/// This is not exported to bindings users as we just use [u8; 32] directly

lightning/src/ln/outbound_payment.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,40 @@ pub enum PaymentSendFailure {
404404
},
405405
}
406406

407+
/// Information which is provided, encrypted, to the payment recipient when sending HTLCs.
408+
///
409+
/// This should generally be constructed with data communicated to us from the recipient (via some
410+
/// form of invoice).
411+
#[derive(Clone)]
412+
pub struct RecipientOnionFields {
413+
/// The [`PaymentSecret`] which is an arbitrary 32 bytes provided by the recipient for us to
414+
/// repeat in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists
415+
/// to authenticate the sender to the recipient and prevent payment-probing (deanonymization)
416+
/// attacks.
417+
///
418+
/// If you do not have one, the [`Route`] you pay over must not contain multiple paths as
419+
/// multi-path payments require a recipient-provided secret.
420+
pub payment_secret: Option<PaymentSecret>,
421+
}
422+
423+
impl RecipientOnionFields {
424+
/// Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common
425+
/// set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`]
426+
/// but do not require or provide any further data.
427+
pub fn secret_only(payment_secret: PaymentSecret) -> Self {
428+
Self { payment_secret: Some(payment_secret) }
429+
}
430+
431+
/// Creates a new [`RecipientOnionFields`] with no fields. This generally does not create
432+
/// payable HTLCs except for spontaneous payments, i.e. this should generally only be used for
433+
/// calls to [`ChannelManager::send_spontaneous_payment`].
434+
///
435+
/// [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment
436+
pub fn spontaneous_empty() -> Self {
437+
Self { payment_secret: None }
438+
}
439+
}
440+
407441
pub(super) struct OutboundPayments {
408442
pub(super) pending_outbound_payments: Mutex<HashMap<PaymentId, PendingOutboundPayment>>,
409443
pub(super) retry_lock: Mutex<()>,

0 commit comments

Comments
 (0)