7
7
// You may not use this file except in accordance with one or both of these
8
8
// licenses.
9
9
10
- use bitcoin:: secp256k1:: { Keypair , Parity , PublicKey , Secp256k1 , SecretKey , self } ;
11
10
use crate :: utils:: test_logger;
11
+ use bitcoin:: secp256k1:: { self , Keypair , Parity , PublicKey , Secp256k1 , SecretKey } ;
12
12
use core:: convert:: TryFrom ;
13
- use lightning:: blinded_path:: BlindedPath ;
14
13
use lightning:: blinded_path:: message:: ForwardNode ;
15
- use lightning:: sign:: EntropySource ;
16
- use lightning:: ln:: PaymentHash ;
14
+ use lightning:: blinded_path:: BlindedPath ;
17
15
use lightning:: ln:: features:: BlindedHopFeatures ;
16
+ use lightning:: ln:: PaymentHash ;
18
17
use lightning:: offers:: invoice:: { BlindedPayInfo , UnsignedBolt12Invoice } ;
19
18
use lightning:: offers:: invoice_request:: InvoiceRequest ;
20
19
use lightning:: offers:: parse:: Bolt12SemanticError ;
20
+ use lightning:: sign:: EntropySource ;
21
21
use lightning:: util:: ser:: Writeable ;
22
22
23
23
#[ inline]
@@ -38,17 +38,17 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
38
38
let even_pubkey = x_only_pubkey. public_key ( Parity :: Even ) ;
39
39
if signing_pubkey == odd_pubkey || signing_pubkey == even_pubkey {
40
40
unsigned_invoice
41
- . sign ( |message : & UnsignedBolt12Invoice |
41
+ . sign ( |message : & UnsignedBolt12Invoice | {
42
42
Ok ( secp_ctx. sign_schnorr_no_aux_rand ( message. as_ref ( ) . as_digest ( ) , & keys) )
43
- )
43
+ } )
44
44
. unwrap ( )
45
45
. write ( & mut buffer)
46
46
. unwrap ( ) ;
47
47
} else {
48
48
unsigned_invoice
49
- . sign ( |message : & UnsignedBolt12Invoice |
49
+ . sign ( |message : & UnsignedBolt12Invoice | {
50
50
Ok ( secp_ctx. sign_schnorr_no_aux_rand ( message. as_ref ( ) . as_digest ( ) , & keys) )
51
- )
51
+ } )
52
52
. unwrap_err ( ) ;
53
53
}
54
54
}
@@ -58,7 +58,9 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
58
58
struct Randomness ;
59
59
60
60
impl 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
+ }
62
64
}
63
65
64
66
fn pubkey ( byte : u8 ) -> PublicKey {
@@ -71,7 +73,7 @@ fn privkey(byte: u8) -> SecretKey {
71
73
}
72
74
73
75
fn build_response < T : secp256k1:: Signing + secp256k1:: Verification > (
74
- invoice_request : & InvoiceRequest , secp_ctx : & Secp256k1 < T >
76
+ invoice_request : & InvoiceRequest , secp_ctx : & Secp256k1 < T > ,
75
77
) -> Result < UnsignedBolt12Invoice , Bolt12SemanticError > {
76
78
let entropy_source = Randomness { } ;
77
79
let intermediate_nodes = [
@@ -85,8 +87,10 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
85
87
] ,
86
88
] ;
87
89
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( ) ,
90
94
] ;
91
95
92
96
let payinfo = vec ! [
0 commit comments