Skip to content

Run rustfmt on chain/transaction, chain/chaininterface, max_payment_path_len_tests, and chanmon_update_fail_tests #3783

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

TheBlueMatt
Copy link
Collaborator

This formats ~36% of the remaining lines in */_tests.rs

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented May 18, 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.

@TheBlueMatt TheBlueMatt requested a review from joostjager May 18, 2025 21:37
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.

Ack, though I'd say that these PRs carry some risk, and the potential benefits may not justify the costs.

.unwrap_err();
assert_eq!(err, RetryableSendFailure::RouteNotFound);

// If our payment_metadata contains 1 additional byte, we'll fail prior to pathfinding.
let mut recipient_onion_too_large_md = recipient_onion_max_md_size.clone();
recipient_onion_too_large_md.payment_metadata.as_mut().map(|mut md| md.push(42));
let err = nodes[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

For these formatting PRs, I think it is better to keep the formatting strictly separate from any other change. So that reviewers know what to look for in a commit.

This send_payment call is moved down, but as a reviewer I question myself whether it is just formatting or also something that changed functionally. I see it is now called with payment_hash_2 rather than payment_hash.

route_params.clone(),
Retry::Attempts(0),
)
.send_payment(payment_hash, max_sized_onion.clone(), id, route_params.clone(), no_retry)
Copy link
Contributor

Choose a reason for hiding this comment

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

My opinion remains unchanged that this isn't necessary to reformat.

@@ -48,6 +48,9 @@ fn test_monitor_and_persister_update_fail() {
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);

let node_a_id = nodes[0].node.get_our_node_id();
Copy link
Contributor

@joostjager joostjager May 19, 2025

Choose a reason for hiding this comment

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

This commit, I think the change isn't worth it. A lot of manual checking for a modest reduction of lines of code (less than 10% on this file) and with changes that not everyone may agree benefit readability.

I've only spot-checked this commit. It looks fine, but we need to be aware that it carries some risk. If I had to produce a change like this I'd probably use search/replace/regex and then adding vars where the compiler complains. This may be easier than reviewing all of the 650 lines in this commit that have near-identical changes.

Not that reviewing needs to be easier than authoring necessarily, but it does raise a flag for me whether we should do it at all.

@@ -38,6 +38,13 @@ use crate::prelude::*;
use crate::sync::{Arc, Mutex};
use bitcoin::hashes::Hash;

fn get_latest_mon_update_id<'a, 'b, 'c>(
Copy link
Contributor

Choose a reason for hiding this comment

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

NIce one

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants