From 0bc5c95484345c6289dffd9a379982a9b66d688f Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 2 Feb 2026 13:55:27 +0000 Subject: [PATCH] Export `outbound_payments` directly rather than via re-exports Every time we use re-exports to hide a module in the public API we end up accidentally breaking the public API due to accidental seals. We did this yet again in e9c6bbccc3ccd4cb121a092229f50e29b3345552 where we moved to using a `CustomTlvs` field in the public API for `RecipientOnionFields` but forgot to re-export it, making it impossible to use downstream. Instead, here, we just actually export `outbound_payments`. Compilation fixes by Claude. --- fuzz/src/chanmon_consistency.rs | 2 +- fuzz/src/full_stack.rs | 3 ++- lightning/src/chain/channelmonitor.rs | 3 ++- lightning/src/events/mod.rs | 7 +++--- lightning/src/ln/accountable_tests.rs | 5 ++--- lightning/src/ln/async_payments_tests.rs | 6 ++--- lightning/src/ln/async_signer_tests.rs | 3 ++- lightning/src/ln/blinded_payment_tests.rs | 6 +++-- lightning/src/ln/chanmon_update_fail_tests.rs | 3 ++- lightning/src/ln/channelmanager.rs | 22 +++++++++---------- lightning/src/ln/functional_test_utils.rs | 3 ++- lightning/src/ln/functional_tests.rs | 5 +++-- lightning/src/ln/interception_tests.rs | 3 ++- lightning/src/ln/invoice_utils.rs | 3 ++- lightning/src/ln/mod.rs | 2 +- lightning/src/ln/monitor_tests.rs | 3 ++- lightning/src/ln/offers_tests.rs | 3 ++- lightning/src/ln/onion_payment.rs | 3 ++- lightning/src/ln/onion_route_tests.rs | 4 ++-- lightning/src/ln/onion_utils.rs | 3 ++- lightning/src/ln/outbound_payment.rs | 5 +++-- lightning/src/ln/payment_tests.rs | 5 +++-- lightning/src/ln/priv_short_conf_tests.rs | 3 ++- lightning/src/ln/quiescence_tests.rs | 2 +- lightning/src/ln/reload_tests.rs | 3 ++- lightning/src/ln/shutdown_tests.rs | 3 ++- lightning/src/ln/splicing_tests.rs | 5 ++--- lightning/src/routing/router.rs | 5 ++--- 28 files changed, 68 insertions(+), 55 deletions(-) diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index f87af5c6ff5..5fb07431b17 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -49,7 +49,6 @@ use lightning::ln::channel::{ use lightning::ln::channel_state::ChannelDetails; use lightning::ln::channelmanager::{ ChainParameters, ChannelManager, ChannelManagerReadArgs, PaymentId, RecentPaymentDetails, - RecipientOnionFields, }; use lightning::ln::functional_test_utils::*; use lightning::ln::funding::{FundingTxInput, SpliceContribution}; @@ -58,6 +57,7 @@ use lightning::ln::msgs::{ BaseMessageHandler, ChannelMessageHandler, CommitmentUpdate, Init, MessageSendEvent, UpdateAddHTLC, }; +use lightning::ln::outbound_payment::RecipientOnionFields; use lightning::ln::script::ShutdownScript; use lightning::ln::types::ChannelId; use lightning::offers::invoice::UnsignedBolt12Invoice; diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index e73db74fa5d..600335b5083 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -43,13 +43,14 @@ use lightning::events::bump_transaction::sync::WalletSourceSync; use lightning::events::Event; use lightning::ln::channel_state::ChannelDetails; use lightning::ln::channelmanager::{ - ChainParameters, ChannelManager, InterceptId, PaymentId, RecipientOnionFields, Retry, + ChainParameters, ChannelManager, InterceptId, PaymentId, }; use lightning::ln::functional_test_utils::*; use lightning::ln::inbound_payment::ExpandedKey; use lightning::ln::peer_handler::{ IgnoringMessageHandler, MessageHandler, PeerManager, SocketDescriptor, }; +use lightning::ln::outbound_payment::{RecipientOnionFields, Retry}; use lightning::ln::script::ShutdownScript; use lightning::ln::types::ChannelId; use lightning::offers::invoice::UnsignedBolt12Invoice; diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 80d0ef125fc..c7dd579967a 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -6774,8 +6774,9 @@ mod tests { DelayedPaymentBasepoint, DelayedPaymentKey, HtlcBasepoint, RevocationBasepoint, RevocationKey, }; - use crate::ln::channelmanager::{HTLCSource, PaymentId, RecipientOnionFields}; + use crate::ln::channelmanager::{HTLCSource, PaymentId}; use crate::ln::functional_test_utils::*; + use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::script::ShutdownScript; use crate::ln::types::ChannelId; use crate::sign::{ChannelSigner, InMemorySigner}; diff --git a/lightning/src/events/mod.rs b/lightning/src/events/mod.rs index b029caa30d7..3d860e9f363 100644 --- a/lightning/src/events/mod.rs +++ b/lightning/src/events/mod.rs @@ -24,9 +24,10 @@ use crate::blinded_path::payment::{ }; use crate::chain::transaction; use crate::ln::channel::FUNDING_CONF_DEADLINE_BLOCKS; -use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields}; +use crate::ln::channelmanager::{InterceptId, PaymentId}; use crate::ln::msgs; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::types::ChannelId; use crate::offers::invoice::Bolt12Invoice; use crate::offers::invoice_request::InvoiceRequest; @@ -662,7 +663,7 @@ pub enum PaymentFailureReason { #[cfg_attr(feature = "std", doc = "")] #[cfg_attr( feature = "std", - doc = "[`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout" + doc = "[`Retry::Timeout`]: crate::ln::outbound_payment::Retry::Timeout" )] RetriesExhausted, /// Either the BOLT 12 invoice was expired by the time we received it or the payment expired while @@ -1082,7 +1083,7 @@ pub enum Event { /// This event will eventually be replayed after failures-to-handle (i.e., the event handler /// returning `Err(ReplayEvent ())`) and will be persisted across restarts. /// - /// [`Retry`]: crate::ln::channelmanager::Retry + /// [`Retry`]: crate::ln::outbound_payment::Retry /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment PaymentFailed { /// The `payment_id` passed to [`ChannelManager::send_payment`]. diff --git a/lightning/src/ln/accountable_tests.rs b/lightning/src/ln/accountable_tests.rs index 442186b376a..16ca1425817 100644 --- a/lightning/src/ln/accountable_tests.rs +++ b/lightning/src/ln/accountable_tests.rs @@ -9,11 +9,10 @@ //! Tests for verifying the correct relay of accountable signals between nodes. -use crate::ln::channelmanager::{ - HTLCForwardInfo, PaymentId, PendingAddHTLCInfo, PendingHTLCInfo, RecipientOnionFields, Retry, -}; +use crate::ln::channelmanager::{HTLCForwardInfo, PaymentId, PendingAddHTLCInfo, PendingHTLCInfo}; use crate::ln::functional_test_utils::*; use crate::ln::msgs::ChannelMessageHandler; +use crate::ln::outbound_payment::{RecipientOnionFields, Retry}; use crate::routing::router::{PaymentParameters, RouteParameters}; fn test_accountable_forwarding_with_override( diff --git a/lightning/src/ln/async_payments_tests.rs b/lightning/src/ln/async_payments_tests.rs index b8d23217cef..528cec44c00 100644 --- a/lightning/src/ln/async_payments_tests.rs +++ b/lightning/src/ln/async_payments_tests.rs @@ -18,10 +18,7 @@ use crate::events::{ PaymentFailureReason, PaymentPurpose, }; use crate::ln::blinded_payment_tests::{fail_blinded_htlc_backwards, get_blinded_route_parameters}; -use crate::ln::channelmanager::{ - Bolt12PaymentError, OptionalOfferPaymentParams, PaymentId, RecipientOnionFields, - MIN_CLTV_EXPIRY_DELTA, -}; +use crate::ln::channelmanager::{OptionalOfferPaymentParams, PaymentId, MIN_CLTV_EXPIRY_DELTA}; use crate::ln::functional_test_utils::*; use crate::ln::inbound_payment; use crate::ln::msgs; @@ -30,6 +27,7 @@ use crate::ln::msgs::{ }; use crate::ln::offers_tests; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::{Bolt12PaymentError, RecipientOnionFields}; use crate::ln::outbound_payment::{ PendingOutboundPayment, Retry, TEST_ASYNC_PAYMENT_TIMEOUT_RELATIVE_EXPIRY, }; diff --git a/lightning/src/ln/async_signer_tests.rs b/lightning/src/ln/async_signer_tests.rs index f38afc41fcc..53187c14168 100644 --- a/lightning/src/ln/async_signer_tests.rs +++ b/lightning/src/ln/async_signer_tests.rs @@ -20,8 +20,9 @@ use crate::events::{ClosureReason, Event}; use crate::ln::chan_utils::ClosingTransaction; use crate::ln::channel::DISCONNECT_PEER_AWAITING_RESPONSE_TICKS; use crate::ln::channel_state::{ChannelDetails, ChannelShutdownState}; -use crate::ln::channelmanager::{PaymentId, RAACommitmentOrder, RecipientOnionFields}; +use crate::ln::channelmanager::{PaymentId, RAACommitmentOrder}; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, ErrorAction, MessageSendEvent}; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::{functional_test_utils::*, msgs}; use crate::sign::ecdsa::EcdsaChannelSigner; use crate::sign::SignerProvider; diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs index 80da76452c0..d78b9dfa4f2 100644 --- a/lightning/src/ln/blinded_payment_tests.rs +++ b/lightning/src/ln/blinded_payment_tests.rs @@ -14,7 +14,7 @@ use crate::blinded_path::payment::{ use crate::blinded_path::utils::is_padded; use crate::blinded_path::{self, BlindedHop}; use crate::events::{Event, HTLCHandlingFailureType, PaymentFailureReason}; -use crate::ln::channelmanager::{self, HTLCFailureMsg, PaymentId, RecipientOnionFields}; +use crate::ln::channelmanager::{self, HTLCFailureMsg, PaymentId}; use crate::ln::functional_test_utils::*; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::{ @@ -22,7 +22,9 @@ use crate::ln::msgs::{ }; use crate::ln::onion_payment; use crate::ln::onion_utils::{self, LocalHTLCFailureReason}; -use crate::ln::outbound_payment::{RecipientCustomTlvs, Retry, IDEMPOTENCY_TIMEOUT_TICKS}; +use crate::ln::outbound_payment::{ + RecipientCustomTlvs, RecipientOnionFields, Retry, IDEMPOTENCY_TIMEOUT_TICKS, +}; use crate::ln::types::ChannelId; use crate::offers::invoice::UnsignedBolt12Invoice; use crate::prelude::*; diff --git a/lightning/src/ln/chanmon_update_fail_tests.rs b/lightning/src/ln/chanmon_update_fail_tests.rs index ff499d049d4..3fa2073d5ba 100644 --- a/lightning/src/ln/chanmon_update_fail_tests.rs +++ b/lightning/src/ln/chanmon_update_fail_tests.rs @@ -19,11 +19,12 @@ use crate::chain::transaction::OutPoint; use crate::chain::{ChannelMonitorUpdateStatus, Listen, Watch}; use crate::events::{ClosureReason, Event, HTLCHandlingFailureType, PaymentPurpose}; use crate::ln::channel::AnnouncementSigsState; -use crate::ln::channelmanager::{PaymentId, RAACommitmentOrder, RecipientOnionFields, Retry}; +use crate::ln::channelmanager::{PaymentId, RAACommitmentOrder}; use crate::ln::msgs; use crate::ln::msgs::{ BaseMessageHandler, ChannelMessageHandler, MessageSendEvent, RoutingMessageHandler, }; +use crate::ln::outbound_payment::{RecipientOnionFields, Retry}; use crate::ln::types::ChannelId; use crate::routing::router::{PaymentParameters, RouteParameters}; use crate::sign::NodeSigner; diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 129a4d58171..a2bc5d109ed 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -84,9 +84,12 @@ use crate::ln::onion_utils::{process_fulfill_attribution_data, AttributionData}; use crate::ln::our_peer_storage::{EncryptedOurPeerStorage, PeerStorageMonitorHolder}; #[cfg(test)] use crate::ln::outbound_payment; +#[cfg(any(test, feature = "_externalize_tests"))] +use crate::ln::outbound_payment::PaymentSendFailure; use crate::ln::outbound_payment::{ - OutboundPayments, PendingOutboundPayment, RecipientCustomTlvs, RetryableInvoiceRequest, - SendAlongPathArgs, StaleExpiration, + Bolt11PaymentError, Bolt12PaymentError, OutboundPayments, PendingOutboundPayment, + ProbeSendFailure, RecipientCustomTlvs, RecipientOnionFields, Retry, RetryableInvoiceRequest, + RetryableSendFailure, SendAlongPathArgs, StaleExpiration, }; use crate::ln::types::ChannelId; use crate::offers::async_receive_offer_cache::AsyncReceiveOfferCache; @@ -175,6 +178,7 @@ use crate::prelude::*; use crate::sync::{Arc, FairRwLock, LockHeldState, LockTestExt, Mutex, RwLock, RwLockReadGuard}; use bitcoin::hex::impl_fmt_traits; +use crate::ln::script::ShutdownScript; use core::borrow::Borrow; use core::cell::RefCell; use core::convert::Infallible; @@ -182,14 +186,6 @@ use core::ops::Deref; use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use core::time::Duration; use core::{cmp, mem}; -// Re-export this for use in the public API. -#[cfg(any(test, feature = "_externalize_tests"))] -pub(crate) use crate::ln::outbound_payment::PaymentSendFailure; -pub use crate::ln::outbound_payment::{ - Bolt11PaymentError, Bolt12PaymentError, ProbeSendFailure, RecipientOnionFields, Retry, - RetryableSendFailure, -}; -use crate::ln::script::ShutdownScript; // We hold various information about HTLC relay in the HTLC objects in Channel itself: // @@ -2262,7 +2258,8 @@ impl< /// # use bitcoin::hashes::Hash; /// # use lightning::events::{Event, EventsProvider}; /// # use lightning::types::payment::PaymentHash; -/// # use lightning::ln::channelmanager::{AChannelManager, OptionalBolt11PaymentParams, PaymentId, RecentPaymentDetails, Retry}; +/// # use lightning::ln::channelmanager::{AChannelManager, OptionalBolt11PaymentParams, PaymentId, RecentPaymentDetails}; +/// # use lightning::ln::outbound_payment::Retry; /// # use lightning_invoice::Bolt11Invoice; /// # /// # fn example( @@ -2420,7 +2417,8 @@ impl< /// ``` /// # use core::time::Duration; /// # use lightning::events::{Event, EventsProvider}; -/// # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry}; +/// # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; +/// # use lightning::ln::outbound_payment::Retry; /// # use lightning::offers::parse::Bolt12SemanticError; /// # use lightning::routing::router::RouteParametersConfig; /// # diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index cea9ea45428..e8965752331 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -27,7 +27,7 @@ use crate::ln::chan_utils::{ }; use crate::ln::channelmanager::{ AChannelManager, ChainParameters, ChannelManager, ChannelManagerReadArgs, PaymentId, - RAACommitmentOrder, RecipientOnionFields, MIN_CLTV_EXPIRY_DELTA, + RAACommitmentOrder, MIN_CLTV_EXPIRY_DELTA, }; use crate::ln::funding::FundingTxInput; use crate::ln::msgs; @@ -35,6 +35,7 @@ use crate::ln::msgs::{ BaseMessageHandler, ChannelMessageHandler, MessageSendEvent, RoutingMessageHandler, }; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::outbound_payment::Retry; use crate::ln::peer_handler::IgnoringMessageHandler; use crate::ln::types::ChannelId; diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index fcb348c690d..8e854b31150 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -33,14 +33,15 @@ use crate::ln::channel::{ MIN_CHAN_DUST_LIMIT_SATOSHIS, UNFUNDED_CHANNEL_AGE_LIMIT_TICKS, }; use crate::ln::channelmanager::{ - PaymentId, RAACommitmentOrder, RecipientOnionFields, BREAKDOWN_TIMEOUT, DISABLE_GOSSIP_TICKS, - ENABLE_GOSSIP_TICKS, MIN_CLTV_EXPIRY_DELTA, + PaymentId, RAACommitmentOrder, BREAKDOWN_TIMEOUT, DISABLE_GOSSIP_TICKS, ENABLE_GOSSIP_TICKS, + MIN_CLTV_EXPIRY_DELTA, }; use crate::ln::msgs; use crate::ln::msgs::{ BaseMessageHandler, ChannelMessageHandler, ErrorAction, MessageSendEvent, RoutingMessageHandler, }; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::types::ChannelId; use crate::ln::{chan_utils, onion_utils}; use crate::routing::gossip::{NetworkGraph, NetworkUpdate}; diff --git a/lightning/src/ln/interception_tests.rs b/lightning/src/ln/interception_tests.rs index 11b5de166f6..c83ef177628 100644 --- a/lightning/src/ln/interception_tests.rs +++ b/lightning/src/ln/interception_tests.rs @@ -12,9 +12,10 @@ //! claim outputs on-chain. use crate::events::{Event, HTLCHandlingFailureReason, HTLCHandlingFailureType}; -use crate::ln::channelmanager::{PaymentId, RecipientOnionFields}; +use crate::ln::channelmanager::PaymentId; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler}; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::routing::router::PaymentParameters; use crate::util::config::HTLCInterceptionFlags; diff --git a/lightning/src/ln/invoice_utils.rs b/lightning/src/ln/invoice_utils.rs index 3026df645d1..7a93a929013 100644 --- a/lightning/src/ln/invoice_utils.rs +++ b/lightning/src/ln/invoice_utils.rs @@ -589,11 +589,12 @@ mod test { use crate::chain::channelmonitor::HTLC_FAIL_BACK_BUFFER; use crate::ln::channelmanager::{ Bolt11InvoiceParameters, OptionalBolt11PaymentParams, PaymentId, PhantomRouteHints, - RecipientOnionFields, Retry, MIN_FINAL_CLTV_EXPIRY_DELTA, + MIN_FINAL_CLTV_EXPIRY_DELTA, }; use crate::ln::functional_test_utils::*; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, MessageSendEvent}; use crate::ln::outbound_payment::RecipientCustomTlvs; + use crate::ln::outbound_payment::{RecipientOnionFields, Retry}; use crate::routing::router::{PaymentParameters, RouteParameters, RouteParametersConfig}; use crate::sign::PhantomKeysManager; use crate::types::payment::{PaymentHash, PaymentPreimage}; diff --git a/lightning/src/ln/mod.rs b/lightning/src/ln/mod.rs index b077c98ae73..d6e0b92f1d0 100644 --- a/lightning/src/ln/mod.rs +++ b/lightning/src/ln/mod.rs @@ -42,7 +42,7 @@ pub mod channel; pub(crate) mod channel; pub mod onion_utils; -mod outbound_payment; +pub mod outbound_payment; pub mod wire; #[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled. diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs index 04915affa20..c3266ae317f 100644 --- a/lightning/src/ln/monitor_tests.rs +++ b/lightning/src/ln/monitor_tests.rs @@ -21,7 +21,8 @@ use crate::events::{Event, ClosureReason, HTLCHandlingFailureType}; use crate::ln::channel; use crate::ln::types::ChannelId; use crate::ln::chan_utils; -use crate::ln::channelmanager::{BREAKDOWN_TIMEOUT, PaymentId, RecipientOnionFields}; +use crate::ln::channelmanager::{BREAKDOWN_TIMEOUT, PaymentId}; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, MessageSendEvent}; use crate::crypto::utils::sign; use crate::util::ser::Writeable; diff --git a/lightning/src/ln/offers_tests.rs b/lightning/src/ln/offers_tests.rs index 1d20d1d368e..12e631b4042 100644 --- a/lightning/src/ln/offers_tests.rs +++ b/lightning/src/ln/offers_tests.rs @@ -50,7 +50,8 @@ use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, DummyTlvs, PaymentContext}; use crate::blinded_path::message::OffersContext; use crate::events::{ClosureReason, Event, HTLCHandlingFailureType, PaidBolt12Invoice, PaymentFailureReason, PaymentPurpose}; -use crate::ln::channelmanager::{Bolt12PaymentError, PaymentId, RecentPaymentDetails, RecipientOnionFields, Retry, self}; +use crate::ln::channelmanager::{PaymentId, RecentPaymentDetails, self}; +use crate::ln::outbound_payment::{Bolt12PaymentError, RecipientOnionFields, Retry}; use crate::types::features::Bolt12InvoiceFeatures; use crate::ln::functional_test_utils::*; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, Init, NodeAnnouncement, OnionMessage, OnionMessageHandler, RoutingMessageHandler, SocketAddress, UnsignedGossipMessage, UnsignedNodeAnnouncement}; diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index fd328e01d78..555cc7a87af 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -750,10 +750,11 @@ pub(super) fn check_incoming_htlc_cltv( #[cfg(test)] mod tests { - use crate::ln::channelmanager::{RecipientOnionFields, MIN_CLTV_EXPIRY_DELTA}; + use crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA; use crate::ln::functional_test_utils::TEST_FINAL_CLTV; use crate::ln::msgs; use crate::ln::onion_utils::create_payment_onion; + use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::types::ChannelId; use crate::routing::router::{Path, RouteHop}; use crate::types::features::{ChannelFeatures, NodeFeatures}; diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index 03557469537..27e0cfafade 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -16,8 +16,7 @@ use crate::events::{Event, HTLCHandlingFailureType, PathFailure, PaymentFailureR use crate::ln::channel::EXPIRE_PREV_CONFIG_TICKS; use crate::ln::channelmanager::{ FailureCode, HTLCForwardInfo, PaymentId, PendingAddHTLCInfo, PendingHTLCInfo, - PendingHTLCRouting, RecipientOnionFields, CLTV_FAR_FAR_AWAY, DISABLE_GOSSIP_TICKS, - MIN_CLTV_EXPIRY_DELTA, + PendingHTLCRouting, CLTV_FAR_FAR_AWAY, DISABLE_GOSSIP_TICKS, MIN_CLTV_EXPIRY_DELTA, }; use crate::ln::functional_test_utils::test_default_channel_config; use crate::ln::msgs; @@ -28,6 +27,7 @@ use crate::ln::msgs::{ use crate::ln::onion_utils::{ self, build_onion_payloads, construct_onion_keys, LocalHTLCFailureReason, }; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::wire::Encode; use crate::routing::gossip::{NetworkUpdate, RoutingFees}; use crate::routing::router::{ diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index fcfac7c5e63..d48fcb25179 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -15,9 +15,10 @@ use crate::crypto::chacha20::ChaCha20; use crate::crypto::streams::ChaChaReader; use crate::events::HTLCHandlingFailureReason; use crate::ln::channel::TOTAL_BITCOIN_SUPPLY_SATOSHIS; -use crate::ln::channelmanager::{HTLCSource, RecipientOnionFields}; +use crate::ln::channelmanager::HTLCSource; use crate::ln::msgs::{self, DecodeError, InboundOnionDummyPayload, OnionPacket, UpdateAddHTLC}; use crate::ln::onion_payment::{HopConnector, NextPacketDetails}; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::offers::invoice_request::InvoiceRequest; use crate::routing::gossip::NetworkUpdate; use crate::routing::router::{BlindedTail, Path, RouteHop, RouteParameters, TrampolineHop}; diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index dd774a00664..ea33bb5d263 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -7,7 +7,7 @@ // You may not use this file except in accordance with one or both of these // licenses. -//! Utilities to send payments and manage outbound payment information. +//! This module contains various types which are used to configure or process outbound payments. use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hashes::Hash; @@ -2805,8 +2805,9 @@ mod tests { use crate::blinded_path::EmptyNodeIdLookUp; use crate::events::{Event, PathFailure, PaymentFailureReason}; - use crate::ln::channelmanager::{PaymentId, RecipientOnionFields}; + use crate::ln::channelmanager::PaymentId; use crate::ln::inbound_payment::ExpandedKey; + use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::outbound_payment::{ Bolt12PaymentError, OutboundPayments, PendingOutboundPayment, RecipientCustomTlvs, Retry, RetryableSendFailure, StaleExpiration, diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index e41e60a46a7..f73c55fd6c6 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -26,13 +26,14 @@ use crate::ln::channel::{ }; use crate::ln::channelmanager::{ HTLCForwardInfo, PaymentId, PendingAddHTLCInfo, PendingHTLCRouting, RecentPaymentDetails, - RecipientOnionFields, BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA, MPP_TIMEOUT_TICKS, + BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA, MPP_TIMEOUT_TICKS, }; use crate::ln::msgs; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, MessageSendEvent}; use crate::ln::onion_utils::{self, LocalHTLCFailureReason}; use crate::ln::outbound_payment::{ - ProbeSendFailure, RecipientCustomTlvs, Retry, RetryableSendFailure, IDEMPOTENCY_TIMEOUT_TICKS, + ProbeSendFailure, RecipientCustomTlvs, RecipientOnionFields, Retry, RetryableSendFailure, + IDEMPOTENCY_TIMEOUT_TICKS, }; use crate::ln::types::ChannelId; use crate::routing::gossip::{EffectiveCapacity, RoutingFees}; diff --git a/lightning/src/ln/priv_short_conf_tests.rs b/lightning/src/ln/priv_short_conf_tests.rs index 83aaca24203..57ee863a71d 100644 --- a/lightning/src/ln/priv_short_conf_tests.rs +++ b/lightning/src/ln/priv_short_conf_tests.rs @@ -14,12 +14,13 @@ use crate::chain::ChannelMonitorUpdateStatus; use crate::events::{ClosureReason, Event, HTLCHandlingFailureType, PaymentFailureReason}; use crate::ln::channel::CHANNEL_ANNOUNCEMENT_PROPAGATION_DELAY; -use crate::ln::channelmanager::{PaymentId, RecipientOnionFields, MIN_CLTV_EXPIRY_DELTA}; +use crate::ln::channelmanager::{PaymentId, MIN_CLTV_EXPIRY_DELTA}; use crate::ln::msgs; use crate::ln::msgs::{ BaseMessageHandler, ChannelMessageHandler, ErrorAction, MessageSendEvent, RoutingMessageHandler, }; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::types::ChannelId; use crate::routing::gossip::RoutingFees; use crate::routing::router::{PaymentParameters, RouteHint, RouteHintHop}; diff --git a/lightning/src/ln/quiescence_tests.rs b/lightning/src/ln/quiescence_tests.rs index a2b14a798c4..d972fb6a5c5 100644 --- a/lightning/src/ln/quiescence_tests.rs +++ b/lightning/src/ln/quiescence_tests.rs @@ -2,10 +2,10 @@ use crate::chain::ChannelMonitorUpdateStatus; use crate::events::{Event, HTLCHandlingFailureType}; use crate::ln::channel::DISCONNECT_PEER_AWAITING_RESPONSE_TICKS; use crate::ln::channelmanager::PaymentId; -use crate::ln::channelmanager::RecipientOnionFields; use crate::ln::functional_test_utils::*; use crate::ln::msgs; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, ErrorAction, MessageSendEvent}; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::util::errors::APIError; use crate::util::ser::Writeable; use crate::util::test_channel_signer::SignerOp; diff --git a/lightning/src/ln/reload_tests.rs b/lightning/src/ln/reload_tests.rs index 4fb2753b6be..a8206dfe850 100644 --- a/lightning/src/ln/reload_tests.rs +++ b/lightning/src/ln/reload_tests.rs @@ -18,7 +18,8 @@ use crate::routing::router::{PaymentParameters, RouteParameters}; use crate::sign::EntropySource; use crate::chain::transaction::OutPoint; use crate::events::{ClosureReason, Event, HTLCHandlingFailureType}; -use crate::ln::channelmanager::{ChannelManager, ChannelManagerReadArgs, PaymentId, RecipientOnionFields, RAACommitmentOrder}; +use crate::ln::channelmanager::{ChannelManager, ChannelManagerReadArgs, PaymentId, RAACommitmentOrder}; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::msgs; use crate::ln::types::ChannelId; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, RoutingMessageHandler, ErrorAction, MessageSendEvent}; diff --git a/lightning/src/ln/shutdown_tests.rs b/lightning/src/ln/shutdown_tests.rs index 192bc6399e4..982dc788f60 100644 --- a/lightning/src/ln/shutdown_tests.rs +++ b/lightning/src/ln/shutdown_tests.rs @@ -14,10 +14,11 @@ use crate::chain::transaction::OutPoint; use crate::chain::ChannelMonitorUpdateStatus; use crate::events::{ClosureReason, Event, HTLCHandlingFailureReason, HTLCHandlingFailureType}; use crate::ln::channel_state::{ChannelDetails, ChannelShutdownState}; -use crate::ln::channelmanager::{self, PaymentId, RecipientOnionFields, Retry}; +use crate::ln::channelmanager::{self, PaymentId}; use crate::ln::msgs; use crate::ln::msgs::{BaseMessageHandler, ChannelMessageHandler, ErrorAction, MessageSendEvent}; use crate::ln::onion_utils::LocalHTLCFailureReason; +use crate::ln::outbound_payment::{RecipientOnionFields, Retry}; use crate::ln::script::ShutdownScript; use crate::ln::types::ChannelId; use crate::prelude::*; diff --git a/lightning/src/ln/splicing_tests.rs b/lightning/src/ln/splicing_tests.rs index ef524db6be3..cf93c6243c4 100644 --- a/lightning/src/ln/splicing_tests.rs +++ b/lightning/src/ln/splicing_tests.rs @@ -17,12 +17,11 @@ use crate::events::bump_transaction::sync::WalletSourceSync; use crate::events::{ClosureReason, Event, FundingInfo, HTLCHandlingFailureType}; use crate::ln::chan_utils; use crate::ln::channel::CHANNEL_ANNOUNCEMENT_PROPAGATION_DELAY; -use crate::ln::channelmanager::{ - provided_init_features, PaymentId, RecipientOnionFields, BREAKDOWN_TIMEOUT, -}; +use crate::ln::channelmanager::{provided_init_features, PaymentId, BREAKDOWN_TIMEOUT}; use crate::ln::functional_test_utils::*; use crate::ln::funding::{FundingTxInput, SpliceContribution}; use crate::ln::msgs::{self, BaseMessageHandler, ChannelMessageHandler, MessageSendEvent}; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::ln::types::ChannelId; use crate::routing::router::{PaymentParameters, RouteParameters}; use crate::util::errors::APIError; diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 42d569415af..b27dee1a450 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -19,9 +19,10 @@ use crate::blinded_path::payment::{ use crate::blinded_path::{BlindedHop, Direction, IntroductionNode}; use crate::crypto::chacha20::ChaCha20; use crate::ln::channel_state::ChannelDetails; -use crate::ln::channelmanager::{PaymentId, RecipientOnionFields, MIN_FINAL_CLTV_EXPIRY_DELTA}; +use crate::ln::channelmanager::{PaymentId, MIN_FINAL_CLTV_EXPIRY_DELTA}; use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT}; use crate::ln::onion_utils; +use crate::ln::outbound_payment::RecipientOnionFields; use crate::offers::invoice::Bolt12Invoice; use crate::offers::static_invoice::StaticInvoice; use crate::routing::gossip::{ @@ -1036,8 +1037,6 @@ impl PaymentParameters { /// whether your router will be allowed to find a multi-part route for this payment. If you /// set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via /// [`RecipientOnionFields::secret_only`]. - /// - /// [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only #[rustfmt::skip] pub fn for_keysend(payee_pubkey: PublicKey, final_cltv_expiry_delta: u32, allow_mpp: bool) -> Self { Self::from_node_id(payee_pubkey, final_cltv_expiry_delta)