Skip to content

Commit bb7db7c

Browse files
committed
Implement OffersMessageFlow functions
1 parent f830dea commit bb7db7c

File tree

3 files changed

+845
-18
lines changed

3 files changed

+845
-18
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, CommitmentUpdat
6565
#[cfg(test)]
6666
use crate::ln::outbound_payment;
6767
use crate::ln::outbound_payment::{Bolt11PaymentError, OutboundPayments, PendingOutboundPayment, RetryableInvoiceRequest, SendAlongPathArgs, StaleExpiration};
68+
use crate::offers::flow::OFFERS_MESSAGE_REQUEST_LIMIT;
6869
use crate::offers::invoice::{Bolt12Invoice, DEFAULT_RELATIVE_EXPIRY, DerivedSigningPubkey, ExplicitSigningPubkey, InvoiceBuilder, UnsignedBolt12Invoice};
6970
use crate::offers::invoice_error::InvoiceError;
7071
use crate::offers::invoice_request::{InvoiceRequest, InvoiceRequestBuilder};
@@ -10341,13 +10342,6 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
1034110342
}
1034210343
} }
1034310344

10344-
/// Defines the maximum number of [`OffersMessage`] including different reply paths to be sent
10345-
/// along different paths.
10346-
/// Sending multiple requests increases the chances of successful delivery in case some
10347-
/// paths are unavailable. However, only one invoice for a given [`PaymentId`] will be paid,
10348-
/// even if multiple invoices are received.
10349-
const OFFERS_MESSAGE_REQUEST_LIMIT: usize = 10;
10350-
1035110345
impl<M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, MR: Deref, L: Deref> ChannelManager<M, T, ES, NS, SP, F, R, MR, L>
1035210346
where
1035310347
M::Target: chain::Watch<<SP::Target as SignerProvider>::EcdsaSigner>,

lightning/src/ln/inbound_payment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub fn create_from_hash(
214214
}
215215

216216
#[cfg(async_payments)]
217-
pub(super) fn create_for_spontaneous_payment(
217+
pub(crate) fn create_for_spontaneous_payment(
218218
keys: &ExpandedKey, min_value_msat: Option<u64>, invoice_expiry_delta_secs: u32,
219219
current_time: u64, min_final_cltv_expiry_delta: Option<u16>,
220220
) -> Result<PaymentSecret, ()> {
@@ -236,7 +236,7 @@ pub(super) fn create_for_spontaneous_payment(
236236
Ok(construct_payment_secret(&iv_bytes, &metadata_bytes, &keys.metadata_key))
237237
}
238238

239-
pub(super) fn calculate_absolute_expiry(
239+
pub(crate) fn calculate_absolute_expiry(
240240
highest_seen_timestamp: u64, invoice_expiry_delta_secs: u32,
241241
) -> u64 {
242242
// We assume that highest_seen_timestamp is pretty close to the current time - it's updated when

0 commit comments

Comments
 (0)