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 , PublicKey , Secp256k1 , SecretKey , self } ;
11
10
use crate :: utils:: test_logger;
11
+ use bitcoin:: secp256k1:: { self , Keypair , 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:: parse:: Bolt12SemanticError ;
20
19
use lightning:: offers:: refund:: Refund ;
20
+ use lightning:: sign:: EntropySource ;
21
21
use lightning:: util:: ser:: Writeable ;
22
22
23
23
#[ inline]
@@ -34,9 +34,9 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
34
34
35
35
if let Ok ( invoice) = build_response ( & refund, pubkey, & secp_ctx) {
36
36
invoice
37
- . sign ( |message : & UnsignedBolt12Invoice |
37
+ . sign ( |message : & UnsignedBolt12Invoice | {
38
38
Ok ( secp_ctx. sign_schnorr_no_aux_rand ( message. as_ref ( ) . as_digest ( ) , & keys) )
39
- )
39
+ } )
40
40
. unwrap ( )
41
41
. write ( & mut buffer)
42
42
. unwrap ( ) ;
@@ -47,7 +47,9 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
47
47
struct Randomness ;
48
48
49
49
impl EntropySource for Randomness {
50
- fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] { [ 42 ; 32 ] }
50
+ fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
51
+ [ 42 ; 32 ]
52
+ }
51
53
}
52
54
53
55
fn pubkey ( byte : u8 ) -> PublicKey {
@@ -60,7 +62,7 @@ fn privkey(byte: u8) -> SecretKey {
60
62
}
61
63
62
64
fn build_response < T : secp256k1:: Signing + secp256k1:: Verification > (
63
- refund : & Refund , signing_pubkey : PublicKey , secp_ctx : & Secp256k1 < T >
65
+ refund : & Refund , signing_pubkey : PublicKey , secp_ctx : & Secp256k1 < T > ,
64
66
) -> Result < UnsignedBolt12Invoice , Bolt12SemanticError > {
65
67
let entropy_source = Randomness { } ;
66
68
let intermediate_nodes = [
@@ -74,8 +76,10 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
74
76
] ,
75
77
] ;
76
78
let paths = vec ! [
77
- BlindedPath :: new_for_message( & intermediate_nodes[ 0 ] , pubkey( 42 ) , & entropy_source, secp_ctx) . unwrap( ) ,
78
- BlindedPath :: new_for_message( & intermediate_nodes[ 1 ] , pubkey( 42 ) , & entropy_source, secp_ctx) . unwrap( ) ,
79
+ BlindedPath :: new_for_message( & intermediate_nodes[ 0 ] , pubkey( 42 ) , & entropy_source, secp_ctx)
80
+ . unwrap( ) ,
81
+ BlindedPath :: new_for_message( & intermediate_nodes[ 1 ] , pubkey( 42 ) , & entropy_source, secp_ctx)
82
+ . unwrap( ) ,
79
83
] ;
80
84
81
85
let payinfo = vec ! [
0 commit comments