]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Prepare to `rustfmt` newly added files
authorMatt Corallo <git@bluematt.me>
Fri, 9 Aug 2024 15:42:48 +0000 (15:42 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 13 Aug 2024 12:55:19 +0000 (12:55 +0000)
In the next commit we'll `rustfmt` newly-added files, but before
we do so we clean up some code so that the resulting files won't be
quite as absurd. We also exclude the new `invoice_utils.rs` file,
as it needs quite substantial cleanups.

lightning/src/ln/bolt11_payment.rs
rustfmt_excluded_files

index 5c5e3711abd828c01d23b5f6cc2e7446ee81345f..d590b209b9f9c41f369c457a54fb98b46d3809bf 100644 (file)
@@ -186,6 +186,8 @@ mod tests {
                let (payment_hash, payment_secret) =
                        nodes[1].node.create_inbound_payment(None, 7200, None).unwrap();
 
+               let secp_ctx = Secp256k1::new();
+               let node_secret = nodes[1].keys_manager.backing.get_node_secret_key();
                let invoice = InvoiceBuilder::new(Currency::Bitcoin)
                        .description("test".into())
                        .payment_hash(Sha256::from_slice(&payment_hash.0).unwrap())
@@ -194,10 +196,7 @@ mod tests {
                        .min_final_cltv_expiry_delta(144)
                        .amount_milli_satoshis(50_000)
                        .payment_metadata(payment_metadata.clone())
-                       .build_signed(|hash| {
-                               Secp256k1::new().sign_ecdsa_recoverable(hash,
-                                       &nodes[1].keys_manager.backing.get_node_secret_key())
-                       })
+                       .build_signed(|hash| secp_ctx.sign_ecdsa_recoverable(hash, &node_secret))
                        .unwrap();
 
                let (hash, onion, params) = payment_parameters_from_invoice(&invoice).unwrap();
index 58f77b4a91b9469d5d84aefad77f46dbbfc01052..898a2c26e8ad73da617826a97b089c6be3988b31 100644 (file)
@@ -41,6 +41,7 @@
 ./lightning/src/ln/functional_test_utils.rs
 ./lightning/src/ln/functional_tests.rs
 ./lightning/src/ln/inbound_payment.rs
+./lightning/src/ln/invoice_utils.rs
 ./lightning/src/ln/max_payment_path_len_tests.rs
 ./lightning/src/ln/mod.rs
 ./lightning/src/ln/monitor_tests.rs