@@ -31,6 +31,7 @@ use bitcoin::hashes::{Hash, HashEngine, HmacEngine};
3131use bitcoin::secp256k1::Secp256k1;
3232use bitcoin::secp256k1::{PublicKey, SecretKey};
3333use bitcoin::{secp256k1, Sequence, SignedAmount};
34+ use lightning_macros::log_scope;
3435
3536use crate::blinded_path::message::{
3637 AsyncPaymentsContext, BlindedMessagePath, MessageForwardNode, OffersContext,
@@ -4280,6 +4281,7 @@ where
42804281 /// [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum
42814282 /// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
42824283 /// [`SendShutdown`]: MessageSendEvent::SendShutdown
4284+ #[log_scope]
42834285 pub fn close_channel(
42844286 &self, channel_id: &ChannelId, counterparty_node_id: &PublicKey,
42854287 ) -> Result<(), APIError> {
@@ -4316,6 +4318,7 @@ where
43164318 /// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee
43174319 /// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]: crate::util::config::ChannelHandshakeConfig::commit_upfront_shutdown_pubkey
43184320 /// [`SendShutdown`]: MessageSendEvent::SendShutdown
4321+ #[log_scope]
43194322 pub fn close_channel_with_feerate_and_script(
43204323 &self, channel_id: &ChannelId, counterparty_node_id: &PublicKey,
43214324 target_feerate_sats_per_1000_weight: Option<u32>, shutdown_script: Option<ShutdownScript>,
@@ -4591,6 +4594,7 @@ where
45914594 ///
45924595 /// Fails if `channel_id` is unknown to the manager, or if the `counterparty_node_id`
45934596 /// isn't the counterparty of the corresponding channel.
4597+ #[log_scope]
45944598 pub fn force_close_broadcasting_latest_txn(
45954599 &self, channel_id: &ChannelId, counterparty_node_id: &PublicKey, error_message: String,
45964600 ) -> Result<(), APIError> {
@@ -4602,6 +4606,7 @@ where
46024606 ///
46034607 /// The provided `error_message` is sent to connected peers for closing channels and should
46044608 /// be a human-readable description of what went wrong.
4609+ #[log_scope]
46054610 pub fn force_close_all_channels_broadcasting_latest_txn(&self, error_message: String) {
46064611 for chan in self.list_channels() {
46074612 let _ = self.force_close_broadcasting_latest_txn(
@@ -4881,6 +4886,7 @@ where
48814886 /// emitted with the new funding output. At this point, a new splice can be negotiated by
48824887 /// calling `splice_channel` again on this channel.
48834888 #[rustfmt::skip]
4889+ #[log_scope]
48844890 pub fn splice_channel(
48854891 &self, channel_id: &ChannelId, counterparty_node_id: &PublicKey,
48864892 contribution: SpliceContribution, funding_feerate_per_kw: u32, locktime: Option<u32>,
@@ -5531,6 +5537,7 @@ where
55315537 /// LDK will not automatically retry this payment, though it may be manually re-sent after an
55325538 /// [`Event::PaymentFailed`] is generated.
55335539 #[rustfmt::skip]
5540+ #[log_scope]
55345541 pub fn send_payment_with_route(
55355542 &self, mut route: Route, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
55365543 payment_id: PaymentId
@@ -5591,6 +5598,7 @@ where
55915598 /// [`UpdateHTLCs`]: MessageSendEvent::UpdateHTLCs
55925599 /// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
55935600 /// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
5601+ #[log_scope]
55945602 pub fn send_payment(
55955603 &self, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
55965604 payment_id: PaymentId, route_params: RouteParameters, retry_strategy: Retry,
@@ -5689,6 +5697,7 @@ where
56895697 /// # Custom Routing Parameters
56905698 /// Users can customize routing parameters via [`RouteParametersConfig`].
56915699 /// To use default settings, call the function with [`RouteParametersConfig::default`].
5700+ #[log_scope]
56925701 pub fn pay_for_bolt11_invoice(
56935702 &self, invoice: &Bolt11Invoice, payment_id: PaymentId, amount_msats: Option<u64>,
56945703 route_params_config: RouteParametersConfig, retry_strategy: Retry,
@@ -5732,6 +5741,7 @@ where
57325741 /// whether or not the payment was successful.
57335742 ///
57345743 /// [timer tick]: Self::timer_tick_occurred
5744+ #[log_scope]
57355745 pub fn send_payment_for_bolt12_invoice(
57365746 &self, invoice: &Bolt12Invoice, context: Option<&OffersContext>,
57375747 ) -> Result<(), Bolt12PaymentError> {
@@ -6004,6 +6014,7 @@ where
60046014 /// [`ChannelManager`], another [`Event::PaymentFailed`] may be generated.
60056015 ///
60066016 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
6017+ #[log_scope]
60076018 pub fn abandon_payment(&self, payment_id: PaymentId) {
60086019 self.abandon_payment_with_reason(payment_id, PaymentFailureReason::UserAbandoned)
60096020 }
@@ -6030,6 +6041,7 @@ where
60306041 ///
60316042 /// [`send_payment`]: Self::send_payment
60326043 /// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
6044+ #[log_scope]
60336045 pub fn send_spontaneous_payment(
60346046 &self, payment_preimage: Option<PaymentPreimage>, recipient_onion: RecipientOnionFields,
60356047 payment_id: PaymentId, route_params: RouteParameters, retry_strategy: Retry,
@@ -6056,6 +6068,7 @@ where
60566068 /// Send a payment that is probing the given route for liquidity. We calculate the
60576069 /// [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
60586070 /// us to easily discern them from real payments.
6071+ #[log_scope]
60596072 pub fn send_probe(&self, path: Path) -> Result<(PaymentHash, PaymentId), ProbeSendFailure> {
60606073 let best_block_height = self.best_block.read().unwrap().height;
60616074 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
@@ -6082,6 +6095,7 @@ where
60826095 /// amount to the given `node_id`.
60836096 ///
60846097 /// See [`ChannelManager::send_preflight_probes`] for more information.
6098+ #[log_scope]
60856099 pub fn send_spontaneous_preflight_probes(
60866100 &self, node_id: PublicKey, amount_msat: u64, final_cltv_expiry_delta: u32,
60876101 liquidity_limit_multiplier: Option<u64>,
@@ -6108,6 +6122,7 @@ where
61086122 /// payment. To mitigate this issue, channels with available liquidity less than the required
61096123 /// amount times the given `liquidity_limit_multiplier` won't be used to send pre-flight
61106124 /// probes. If `None` is given as `liquidity_limit_multiplier`, it defaults to `3`.
6125+ #[log_scope]
61116126 pub fn send_preflight_probes(
61126127 &self, route_params: RouteParameters, liquidity_limit_multiplier: Option<u64>,
61136128 ) -> Result<Vec<(PaymentHash, PaymentId)>, ProbeSendFailure> {
@@ -7277,6 +7292,7 @@ where
72777292 ///
72787293 /// Users implementing their own background processing logic should call this in irregular,
72797294 /// randomly-distributed intervals.
7295+ #[log_scope]
72807296 pub fn process_pending_htlc_forwards(&self) {
72817297 if self
72827298 .pending_htlc_forwards_processor
@@ -8307,6 +8323,7 @@ where
83078323 ///
83088324 /// [`ChannelUpdate`]: msgs::ChannelUpdate
83098325 /// [`ChannelConfig`]: crate::util::config::ChannelConfig
8326+ #[log_scope]
83108327 pub fn timer_tick_occurred(&self) {
83118328 PersistenceNotifierGuard::optionally_notify(self, || {
83128329 let mut should_persist = NotifyOption::SkipPersistNoEvents;
@@ -8840,6 +8857,7 @@ where
88408857 /// [`create_inbound_payment`]: Self::create_inbound_payment
88418858 /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
88428859 /// [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs
8860+ #[log_scope]
88438861 pub fn claim_funds(&self, payment_preimage: PaymentPreimage) {
88448862 self.claim_payment_internal(payment_preimage, false);
88458863 }
@@ -8853,6 +8871,7 @@ where
88538871 /// claim, otherwise you may unintentionally agree to some protocol you do not understand.
88548872 ///
88558873 /// [`claim_funds`]: Self::claim_funds
8874+ #[log_scope]
88568875 pub fn claim_funds_with_known_custom_tlvs(&self, payment_preimage: PaymentPreimage) {
88578876 self.claim_payment_internal(payment_preimage, true);
88588877 }
@@ -10089,6 +10108,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1008910108 ///
1009010109 /// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest
1009110110 /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id
10111+ #[log_scope]
1009210112 pub fn accept_inbound_channel(
1009310113 &self, temporary_channel_id: &ChannelId, counterparty_node_id: &PublicKey,
1009410114 user_channel_id: u128, config_overrides: Option<ChannelConfigOverrides>,
@@ -13300,6 +13320,7 @@ where
1330013320 /// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath
1330113321 /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths
1330213322 /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments
13323+ #[log_scope]
1330313324 pub fn pay_for_offer(
1330413325 &self, offer: &Offer, amount_msats: Option<u64>, payment_id: PaymentId,
1330513326 optional_params: OptionalOfferPaymentParams,
@@ -13329,6 +13350,7 @@ where
1332913350
1333013351 /// Pays for an [`Offer`] which was built by resolving a human readable name. It is otherwise
1333113352 /// identical to [`Self::pay_for_offer`].
13353+ #[log_scope]
1333213354 pub fn pay_for_offer_from_hrn(
1333313355 &self, offer: &OfferFromHrn, amount_msats: u64, payment_id: PaymentId,
1333413356 optional_params: OptionalOfferPaymentParams,
@@ -13371,6 +13393,7 @@ where
1337113393 /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
1337213394 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
1337313395 /// [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity
13396+ #[log_scope]
1337413397 pub fn pay_for_offer_with_quantity(
1337513398 &self, offer: &Offer, amount_msats: Option<u64>, payment_id: PaymentId,
1337613399 optional_params: OptionalOfferPaymentParams, quantity: u64,
@@ -13532,6 +13555,7 @@ where
1353213555 /// [`PaymentFailureReason::InvoiceRequestRejected`]: crate::events::PaymentFailureReason::InvoiceRequestRejected
1353313556 #[cfg(feature = "dnssec")]
1353413557 #[deprecated(note = "Use bitcoin-payment-instructions and pay_for_offer_from_hrn instead")]
13558+ #[log_scope]
1353513559 pub fn pay_for_offer_from_human_readable_name(
1353613560 &self, name: HumanReadableName, amount_msats: u64, payment_id: PaymentId,
1353713561 optional_params: OptionalOfferPaymentParams, dns_resolvers: Vec<Destination>,
@@ -13833,6 +13857,7 @@ where
1383313857 }
1383413858
1383513859 #[cfg(any(test, feature = "_test_utils"))]
13860+ #[log_scope]
1383613861 pub fn get_and_clear_pending_events(&self) -> Vec<events::Event> {
1383713862 let events = core::cell::RefCell::new(Vec::new());
1383813863 let event_handler = |event: events::Event| Ok(events.borrow_mut().push(event));
0 commit comments