@@ -13,7 +13,7 @@ use bitcoin::hashes::{Hash, HashEngine};
13
13
use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
14
14
use bitcoin:: secp256k1:: { self , PublicKey , Scalar , Secp256k1 , SecretKey } ;
15
15
16
- use crate :: chain:: keysinterface:: { KeysInterface , NodeSigner , Recipient } ;
16
+ use crate :: chain:: keysinterface:: { EntropySource , NodeSigner , Recipient } ;
17
17
use super :: packet:: ControlTlvs ;
18
18
use super :: utils;
19
19
use crate :: ln:: msgs:: DecodeError ;
@@ -63,11 +63,11 @@ impl BlindedPath {
63
63
///
64
64
/// Errors if less than two hops are provided or if `node_pk`(s) are invalid.
65
65
// TODO: make all payloads the same size with padding + add dummy hops
66
- pub fn new < K : KeysInterface , T : secp256k1:: Signing + secp256k1:: Verification >
67
- ( node_pks : & [ PublicKey ] , keys_manager : & K , secp_ctx : & Secp256k1 < T > ) -> Result < Self , ( ) >
66
+ pub fn new < ES : EntropySource , T : secp256k1:: Signing + secp256k1:: Verification >
67
+ ( node_pks : & [ PublicKey ] , entropy_source : & ES , secp_ctx : & Secp256k1 < T > ) -> Result < Self , ( ) >
68
68
{
69
69
if node_pks. len ( ) < 2 { return Err ( ( ) ) }
70
- let blinding_secret_bytes = keys_manager . get_secure_random_bytes ( ) ;
70
+ let blinding_secret_bytes = entropy_source . get_secure_random_bytes ( ) ;
71
71
let blinding_secret = SecretKey :: from_slice ( & blinding_secret_bytes[ ..] ) . expect ( "RNG is busted" ) ;
72
72
let introduction_node_id = node_pks[ 0 ] ;
73
73
@@ -79,11 +79,11 @@ impl BlindedPath {
79
79
}
80
80
81
81
// Advance the blinded path by one hop, so make the second hop into the new introduction node.
82
- pub ( super ) fn advance_by_one < K : Deref , T : secp256k1:: Signing + secp256k1:: Verification >
83
- ( & mut self , keys_manager : & K , secp_ctx : & Secp256k1 < T > ) -> Result < ( ) , ( ) >
84
- where K :: Target : KeysInterface
82
+ pub ( super ) fn advance_by_one < NS : Deref , T : secp256k1:: Signing + secp256k1:: Verification >
83
+ ( & mut self , node_signer : & NS , secp_ctx : & Secp256k1 < T > ) -> Result < ( ) , ( ) >
84
+ where NS :: Target : NodeSigner
85
85
{
86
- let control_tlvs_ss = keys_manager . ecdh ( Recipient :: Node , & self . blinding_point , None ) ?;
86
+ let control_tlvs_ss = node_signer . ecdh ( Recipient :: Node , & self . blinding_point , None ) ?;
87
87
let rho = onion_utils:: gen_rho_from_shared_secret ( & control_tlvs_ss. secret_bytes ( ) ) ;
88
88
let encrypted_control_tlvs = self . blinded_hops . remove ( 0 ) . encrypted_payload ;
89
89
let mut s = Cursor :: new ( & encrypted_control_tlvs) ;
0 commit comments