Skip to content

Commit 2e61d94

Browse files
authored
Merge pull request #4082 from joostjager/payment-logging
Add struct-level logging to OutboundPayments
2 parents 07bf08b + 5fc6282 commit 2e61d94

File tree

2 files changed

+121
-131
lines changed

2 files changed

+121
-131
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ pub struct ChannelManager<
26802680
/// See `PendingOutboundPayment` documentation for more info.
26812681
///
26822682
/// See `ChannelManager` struct-level documentation for lock order requirements.
2683-
pending_outbound_payments: OutboundPayments,
2683+
pending_outbound_payments: OutboundPayments<L>,
26842684

26852685
/// SCID/SCID Alias -> forward infos. Key of 0 means payments received.
26862686
///
@@ -3893,7 +3893,7 @@ where
38933893
best_block: RwLock::new(params.best_block),
38943894

38953895
outbound_scid_aliases: Mutex::new(new_hash_set()),
3896-
pending_outbound_payments: OutboundPayments::new(new_hash_map()),
3896+
pending_outbound_payments: OutboundPayments::new(new_hash_map(), logger.clone()),
38973897
forward_htlcs: Mutex::new(new_hash_map()),
38983898
decode_update_add_htlcs: Mutex::new(new_hash_map()),
38993899
claimable_payments: Mutex::new(ClaimablePayments { claimable_payments: new_hash_map(), pending_claiming_payments: new_hash_map() }),
@@ -5166,7 +5166,7 @@ where
51665166
self.pending_outbound_payments
51675167
.send_payment(payment_hash, recipient_onion, payment_id, Retry::Attempts(0),
51685168
route_params, &&router, self.list_usable_channels(), || self.compute_inflight_htlcs(),
5169-
&self.entropy_source, &self.node_signer, best_block_height, &self.logger,
5169+
&self.entropy_source, &self.node_signer, best_block_height,
51705170
&self.pending_events, |args| self.send_payment_along_path(args))
51715171
}
51725172

@@ -5225,7 +5225,6 @@ where
52255225
&self.entropy_source,
52265226
&self.node_signer,
52275227
best_block_height,
5228-
&self.logger,
52295228
&self.pending_events,
52305229
|args| self.send_payment_along_path(args),
52315230
)
@@ -5324,7 +5323,6 @@ where
53245323
&self.entropy_source,
53255324
&self.node_signer,
53265325
best_block_height,
5327-
&self.logger,
53285326
&self.pending_events,
53295327
|args| self.send_payment_along_path(args),
53305328
)
@@ -5394,7 +5392,6 @@ where
53945392
&self,
53955393
&self.secp_ctx,
53965394
best_block_height,
5397-
&self.logger,
53985395
&self.pending_events,
53995396
|args| self.send_payment_along_path(args),
54005397
)
@@ -5515,7 +5512,6 @@ where
55155512
&self,
55165513
&self.secp_ctx,
55175514
best_block_height,
5518-
&self.logger,
55195515
&self.pending_events,
55205516
|args| self.send_payment_along_path(args),
55215517
);
@@ -5615,7 +5611,6 @@ where
56155611
&self.entropy_source,
56165612
&self.node_signer,
56175613
best_block_height,
5618-
&self.logger,
56195614
&self.pending_events,
56205615
|args| self.send_payment_along_path(args),
56215616
)
@@ -6772,7 +6767,6 @@ where
67726767
&self.node_signer,
67736768
best_block_height,
67746769
&self.pending_events,
6775-
&self.logger,
67766770
|args| self.send_payment_along_path(args),
67776771
);
67786772
if needs_persist {
@@ -8156,7 +8150,6 @@ where
81568150
self.probing_cookie_secret,
81578151
&self.secp_ctx,
81588152
&self.pending_events,
8159-
&self.logger,
81608153
&mut from_monitor_update_completion,
81618154
);
81628155
if let Some(update) = from_monitor_update_completion {
@@ -8838,7 +8831,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
88388831
from_onchain,
88398832
&mut ev_completion_action,
88408833
&self.pending_events,
8841-
&self.logger,
88428834
);
88438835
// If an event was generated, `claim_htlc` set `ev_completion_action` to None, if
88448836
// not, we should go ahead and run it now (as the claim was duplicative), at least
@@ -16552,7 +16544,8 @@ where
1655216544
}
1655316545
pending_outbound_payments = Some(outbounds);
1655416546
}
16555-
let pending_outbounds = OutboundPayments::new(pending_outbound_payments.unwrap());
16547+
let pending_outbounds =
16548+
OutboundPayments::new(pending_outbound_payments.unwrap(), args.logger.clone());
1655616549

1655716550
for (peer_pubkey, peer_storage) in peer_storage_dir {
1655816551
if let Some(peer_state) = per_peer_state.get_mut(&peer_pubkey) {
@@ -16858,7 +16851,6 @@ where
1685816851
session_priv_bytes,
1685916852
&path,
1686016853
best_block_height,
16861-
logger,
1686216854
);
1686316855
}
1686416856
}
@@ -16958,7 +16950,6 @@ where
1695816950
true,
1695916951
&mut compl_action,
1696016952
&pending_events,
16961-
&&logger,
1696216953
);
1696316954
// If the completion action was not consumed, then there was no
1696416955
// payment to claim, and we need to tell the `ChannelMonitor`

0 commit comments

Comments
 (0)