77// You may not use this file except in accordance with one or both of these
88// licenses.
99
10- use bitcoin:: secp256k1:: { Keypair , Parity , PublicKey , Secp256k1 , SecretKey , self } ;
1110use crate :: utils:: test_logger;
11+ use bitcoin:: secp256k1:: { self , Keypair , Parity , PublicKey , Secp256k1 , SecretKey } ;
1212use core:: convert:: TryFrom ;
13- use lightning:: blinded_path:: BlindedPath ;
1413use lightning:: blinded_path:: message:: ForwardNode ;
15- use lightning:: sign:: EntropySource ;
16- use lightning:: ln:: PaymentHash ;
14+ use lightning:: blinded_path:: BlindedPath ;
1715use lightning:: ln:: features:: BlindedHopFeatures ;
16+ use lightning:: ln:: PaymentHash ;
1817use lightning:: offers:: invoice:: { BlindedPayInfo , UnsignedBolt12Invoice } ;
1918use lightning:: offers:: invoice_request:: InvoiceRequest ;
2019use lightning:: offers:: parse:: Bolt12SemanticError ;
20+ use lightning:: sign:: EntropySource ;
2121use lightning:: util:: ser:: Writeable ;
2222
2323#[ inline]
@@ -38,17 +38,17 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
3838 let even_pubkey = x_only_pubkey. public_key ( Parity :: Even ) ;
3939 if signing_pubkey == odd_pubkey || signing_pubkey == even_pubkey {
4040 unsigned_invoice
41- . sign ( |message : & UnsignedBolt12Invoice |
41+ . sign ( |message : & UnsignedBolt12Invoice | {
4242 Ok ( secp_ctx. sign_schnorr_no_aux_rand ( message. as_ref ( ) . as_digest ( ) , & keys) )
43- )
43+ } )
4444 . unwrap ( )
4545 . write ( & mut buffer)
4646 . unwrap ( ) ;
4747 } else {
4848 unsigned_invoice
49- . sign ( |message : & UnsignedBolt12Invoice |
49+ . sign ( |message : & UnsignedBolt12Invoice | {
5050 Ok ( secp_ctx. sign_schnorr_no_aux_rand ( message. as_ref ( ) . as_digest ( ) , & keys) )
51- )
51+ } )
5252 . unwrap_err ( ) ;
5353 }
5454 }
@@ -58,7 +58,9 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
5858struct Randomness ;
5959
6060impl EntropySource for Randomness {
61- fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] { [ 42 ; 32 ] }
61+ fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
62+ [ 42 ; 32 ]
63+ }
6264}
6365
6466fn pubkey ( byte : u8 ) -> PublicKey {
@@ -71,7 +73,7 @@ fn privkey(byte: u8) -> SecretKey {
7173}
7274
7375fn build_response < T : secp256k1:: Signing + secp256k1:: Verification > (
74- invoice_request : & InvoiceRequest , secp_ctx : & Secp256k1 < T >
76+ invoice_request : & InvoiceRequest , secp_ctx : & Secp256k1 < T > ,
7577) -> Result < UnsignedBolt12Invoice , Bolt12SemanticError > {
7678 let entropy_source = Randomness { } ;
7779 let intermediate_nodes = [
@@ -85,8 +87,10 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
8587 ] ,
8688 ] ;
8789 let paths = vec ! [
88- BlindedPath :: new_for_message( & intermediate_nodes[ 0 ] , pubkey( 42 ) , & entropy_source, secp_ctx) . unwrap( ) ,
89- BlindedPath :: new_for_message( & intermediate_nodes[ 1 ] , pubkey( 42 ) , & entropy_source, secp_ctx) . unwrap( ) ,
90+ BlindedPath :: new_for_message( & intermediate_nodes[ 0 ] , pubkey( 42 ) , & entropy_source, secp_ctx)
91+ . unwrap( ) ,
92+ BlindedPath :: new_for_message( & intermediate_nodes[ 1 ] , pubkey( 42 ) , & entropy_source, secp_ctx)
93+ . unwrap( ) ,
9094 ] ;
9195
9296 let payinfo = vec ! [
0 commit comments