File tree Expand file tree Collapse file tree 5 files changed +22
-0
lines changed Expand file tree Collapse file tree 5 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,10 @@ impl KeysInterface for KeyProvider {
223
223
fn sign_invoice ( & self , _invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > {
224
224
unreachable ! ( )
225
225
}
226
+
227
+ fn get_phantom_secret ( & self , _scid : u64 ) -> Result < SecretKey , ( ) > {
228
+ Err ( ( ) )
229
+ }
226
230
}
227
231
228
232
impl KeyProvider {
Original file line number Diff line number Diff line change @@ -336,6 +336,10 @@ impl KeysInterface for KeyProvider {
336
336
fn sign_invoice ( & self , _invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > {
337
337
unreachable ! ( )
338
338
}
339
+
340
+ fn get_phantom_secret ( & self , _scid : u64 ) -> Result < SecretKey , ( ) > {
341
+ Err ( ( ) )
342
+ }
339
343
}
340
344
341
345
#[ inline]
Original file line number Diff line number Diff line change @@ -409,6 +409,9 @@ pub trait KeysInterface {
409
409
///
410
410
/// This method must return the same value each time it is called.
411
411
fn get_inbound_payment_key_material ( & self ) -> KeyMaterial ;
412
+
413
+ /// Get a secret key for use in receiving phantom node payments.
414
+ fn get_phantom_secret ( & self , scid : u64 ) -> Result < SecretKey , ( ) > ;
412
415
}
413
416
414
417
#[ derive( Clone ) ]
@@ -1131,6 +1134,13 @@ impl KeysInterface for KeysManager {
1131
1134
fn sign_invoice ( & self , invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > {
1132
1135
Ok ( self . secp_ctx . sign_recoverable ( & hash_to_message ! ( & Sha256 :: hash( & invoice_preimage) ) , & self . get_node_secret ( ) ) )
1133
1136
}
1137
+
1138
+ fn get_phantom_secret ( & self , _scid : u64 ) -> Result < SecretKey , ( ) > {
1139
+ match self . phantom_secret {
1140
+ Some ( key) => Ok ( key. clone ( ) ) ,
1141
+ None => Err ( ( ) )
1142
+ }
1143
+ }
1134
1144
}
1135
1145
1136
1146
// Ensure that BaseSign can have a vtable
Original file line number Diff line number Diff line change @@ -5885,6 +5885,7 @@ mod tests {
5885
5885
fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] { [ 0 ; 32 ] }
5886
5886
fn read_chan_signer ( & self , _data : & [ u8 ] ) -> Result < Self :: Signer , DecodeError > { panic ! ( ) ; }
5887
5887
fn sign_invoice ( & self , _invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > { panic ! ( ) ; }
5888
+ fn get_phantom_secret ( & self , _scid : u64 ) -> Result < SecretKey , ( ) > { panic ! ( ) ; }
5888
5889
}
5889
5890
5890
5891
fn public_from_secret_hex ( secp_ctx : & Secp256k1 < All > , hex : & str ) -> PublicKey {
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ impl keysinterface::KeysInterface for OnlyReadsKeysInterface {
88
88
) )
89
89
}
90
90
fn sign_invoice ( & self , _invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > { unreachable ! ( ) ; }
91
+ fn get_phantom_secret ( & self , _scid : u64 ) -> Result < SecretKey , ( ) > { unreachable ! ( ) ; }
91
92
}
92
93
93
94
pub struct TestChainMonitor < ' a > {
@@ -531,6 +532,8 @@ impl keysinterface::KeysInterface for TestKeysInterface {
531
532
fn sign_invoice ( & self , invoice_preimage : Vec < u8 > ) -> Result < RecoverableSignature , ( ) > {
532
533
self . backing . sign_invoice ( invoice_preimage)
533
534
}
535
+
536
+ fn get_phantom_secret ( & self , scid : u64 ) -> Result < SecretKey , ( ) > { self . backing . get_phantom_secret ( scid) }
534
537
}
535
538
536
539
impl TestKeysInterface {
You can’t perform that action at this time.
0 commit comments