-
Notifications
You must be signed in to change notification settings - Fork 421
rustfmt: Run on util/* (2/2)
#3323
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
rustfmt: Run on util/* (2/2)
#3323
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3323 +/- ##
==========================================
- Coverage 88.31% 88.28% -0.04%
==========================================
Files 149 149
Lines 112839 113376 +537
Branches 112839 113376 +537
==========================================
+ Hits 99655 100089 +434
- Misses 10700 10765 +65
- Partials 2484 2522 +38 ☔ View full report in Codecov by Sentry. |
6c4dd83 to
9b991df
Compare
|
Ugh, can we split this? 42 commits in one PR is just a lot... |
Alright, happy to if you prefer (although at least half of these commits are one-line diffs). Now split out ~the first half of commits to #3324. |
60ae0af to
e2dcdc7
Compare
|
Rebased after #3327 landed. |
e2dcdc7 to
bc122e3
Compare
|
Rebased after #3324 landed. |
bc122e3 to
572f48c
Compare
|
Rebased to resolve minor conflicts. |
572f48c to
449a0d6
Compare
|
Rebased once more to resolve minor conflicts. Any additional comments here after we landed the split-out commits in #3324, @TheBlueMatt ? |
449a0d6 to
b909a7a
Compare
|
Rebased once more to resolve minor conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments. Maybe could have been split across PRs.
| do_test!(concat!("01", "08", "0100000000000000"), Some(72057594037927936), None, None, None); | ||
| do_test!(concat!("02", "08", "0000000000000226"), None, Some((0 << 30) | (0 << 5) | (550 << 0)), None, None); | ||
| do_test!( | ||
| concat!("01", "08", "0100000000000000"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how much readable it would be pulling out stuff here into variables? Seems that might just make stuff more confusing?
| } | ||
|
|
||
| fn sign_counterparty_htlc_transaction(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<secp256k1::All>) -> Result<Signature, ()> { | ||
| Ok(EcdsaChannelSigner::sign_holder_htlc_transaction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be less verbose if we use self.inner.sign_holder_htlc_transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I had to revert the changes as otherwise cargo would complain under cfg(taproot):
error[E0034]: multiple applicable items in scope
--> lightning/src/util/test_channel_signer.rs:316:17
|
316 | Ok(self.inner.sign_holder_htlc_transaction(htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `sign_holder_htlc_transaction` found
|
note: candidate #1 is defined in an impl of the trait `TaprootChannelSigner` for the type `InMemorySigner`
--> lightning/src/sign/mod.rs:1755:2
|
1755 | / fn sign_holder_htlc_transaction(
1756 | | &self, htlc_tx: &Transaction, input: usize, htlc_descriptor: &HTLCDescriptor,
1757 | | secp_ctx: &Secp256k1<All>,
1758 | | ) -> Result<schnorr::Signature, ()> {
| |_______________________________________^
note: candidate #2 is defined in an impl of the trait `sign::ecdsa::EcdsaChannelSigner` for the type `InMemorySigner`
--> lightning/src/sign/mod.rs:1593:2
|
1593 | / fn sign_holder_htlc_transaction(
1594 | | &self, htlc_tx: &Transaction, input: usize, htlc_descriptor: &HTLCDescriptor,
1595 | | secp_ctx: &Secp256k1<secp256k1::All>,
1596 | | ) -> Result<Signature, ()> {
| |______________________________^
help: disambiguate the method for candidate #1
|
316 | Ok(TaprootChannelSigner::sign_holder_htlc_transaction(&self.inner, htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: disambiguate the method for candidate #2
|
316 | Ok(sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction(&self.inner, htlc_tx, input, htlc_descriptor, secp_ctx).unwrap())
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
b909a7a to
0750550
Compare
|
Addressed all but one comment. |
0750550 to
03ccbe8
Compare
|
Rebased once more to resolve minor conflict. @TheBlueMatt any further comments here? |
03ccbe8 to
7153e35
Compare
7153e35 to
d69ca2c
Compare
|
Fixed the missing |
d69ca2c to
9b420e3
Compare
.. we pull out `Mutex` field initialization into dedicated variables as they might otherwise land on the same line when formatting, which might lead to lockorder violation false-positives when compiled with the `backtrace` feature.
9b420e3 to
5d6eaec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good enough. Some stuff I'll clean up in a followup, some of it pre-existing.
PR lightningdevkit#3323 introduced some extra variables to avoid `rustfmt` making a total mess of our code, but introduced a few that don't make `rustfmt` do dumb things, which we remove here.
This is PR 2/2, based on #3324.
The diff is a bit larger for this one, but AFAICT the changes look mostly reasonable (besides the oddity commented below).
FWIW, I had a look at currently open inflight PRs and the conflicts should be minimal if I'm not overlooking something.