Skip to content

rustfmt forwarding-related methods #3930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 16, 2025

Conversation

tnull
Copy link
Contributor

@tnull tnull commented Jul 15, 2025

In the hopes of speeding up the review process, we split out the rustfmt-related commits of #3891 (as requested).

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jul 15, 2025

👋 Thanks for assigning @joostjager as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think good decision to get this refactor/reformat out of the way first.

@tnull tnull force-pushed the 2025-07-rustfmt-forwarding-related branch 3 times, most recently from ae1d2de to e7a06f4 Compare July 15, 2025 15:33
@valentinewallace
Copy link
Contributor

rustfmt CI check is failing

@tnull tnull force-pushed the 2025-07-rustfmt-forwarding-related branch from e7a06f4 to 359e17e Compare July 16, 2025 07:33
Copy link
Contributor Author

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed the outstanding comments and force-pushed with a minor adjustment:

> git diff-tree -U2 e7a06f417 359e17e14
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index d590748c2..525ce013c 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -6879,25 +6879,19 @@ where
                                                                self.best_block.read().unwrap().height,
                                                        );
-                                                       let short_channel_id = $htlc.prev_hop.short_channel_id;
-                                                       let user_channel_id = $htlc.prev_hop.user_channel_id;
                                                        let counterparty_node_id = $htlc.prev_hop.counterparty_node_id;
-                                                       let channel_id = prev_channel_id;
-                                                       let outpoint = prev_funding_outpoint;
-                                                       let htlc_id = $htlc.prev_hop.htlc_id;
                                                        let incoming_packet_shared_secret =
                                                                $htlc.prev_hop.incoming_packet_shared_secret;
-                                                       let cltv_expiry = Some(cltv_expiry);
                                                        failed_forwards.push((
                                                                HTLCSource::PreviousHopData(HTLCPreviousHopData {
-                                                                       short_channel_id,
-                                                                       user_channel_id,
+                                                                       short_channel_id: $htlc.prev_hop.short_channel_id,
+                                                                       user_channel_id: $htlc.prev_hop.user_channel_id,
                                                                        counterparty_node_id,
-                                                                       channel_id,
-                                                                       outpoint,
-                                                                       htlc_id,
+                                                                       channel_id: prev_channel_id,
+                                                                       outpoint: prev_funding_outpoint,
+                                                                       htlc_id: $htlc.prev_hop.htlc_id,
                                                                        incoming_packet_shared_secret,
                                                                        phantom_shared_secret,
                                                                        blinded_failure,
-                                                                       cltv_expiry,
+                                                                       cltv_expiry: Some(cltv_expiry),
                                                                }),
                                                                payment_hash,

@tnull tnull self-assigned this Jul 16, 2025
@tnull tnull moved this to Goal: Merge in Weekly Goals Jul 16, 2025
@tnull tnull added the weekly goal Someone wants to land this this week label Jul 16, 2025
tnull added 7 commits July 16, 2025 11:20
We split up the huge `process_pending_htlcs_forwards` method and move
the `forward` case of the processing code to a `process_forward_htlcs`
helper.
We split up the huge `process_pending_htlcs_forwards` method and move
the `receive` case of the processing code to a `process_receive_htlcs`
helper.
We previously added them above `process_pending_htlc_forwards` to have
`git` show a reasonable diff. But, since we prefer the helpers to live
below the actual method, we move them down in this commit.
@tnull tnull force-pushed the 2025-07-rustfmt-forwarding-related branch from 359e17e to d86268c Compare July 16, 2025 09:22
@tnull tnull requested a review from joostjager July 16, 2025 10:12
@tnull tnull merged commit 95ca0dc into lightningdevkit:main Jul 16, 2025
27 of 28 checks passed
@github-project-automation github-project-automation bot moved this from Goal: Merge to Done in Weekly Goals Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
weekly goal Someone wants to land this this week
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants