From 30879ed0350257ecf0281e8fb617abfb26cd762d Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 9 Aug 2024 15:42:48 +0000 Subject: [PATCH] Prepare to `rustfmt` newly added files 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 | 7 +++---- rustfmt_excluded_files | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lightning/src/ln/bolt11_payment.rs b/lightning/src/ln/bolt11_payment.rs index 5c5e3711a..d590b209b 100644 --- a/lightning/src/ln/bolt11_payment.rs +++ b/lightning/src/ln/bolt11_payment.rs @@ -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(); diff --git a/rustfmt_excluded_files b/rustfmt_excluded_files index 58f77b4a9..898a2c26e 100644 --- a/rustfmt_excluded_files +++ b/rustfmt_excluded_files @@ -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 -- 2.39.5