X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fonion_message%2Fblinded_path.rs;h=946e5e7cf8d74472e9fa56a719f2a8dd5e426ba5;hb=9f41bd7f6492ca146a852c779f072d5b87581fed;hp=1268a8176e9f28ef626ac356491e03eae5c64a1f;hpb=5824e226cad67e32d5e8be71ebbb6f91a3fc2116;p=rust-lightning diff --git a/lightning/src/onion_message/blinded_path.rs b/lightning/src/onion_message/blinded_path.rs index 1268a817..946e5e7c 100644 --- a/lightning/src/onion_message/blinded_path.rs +++ b/lightning/src/onion_message/blinded_path.rs @@ -63,11 +63,11 @@ impl BlindedPath { /// /// Errors if less than two hops are provided or if `node_pk`(s) are invalid. // TODO: make all payloads the same size with padding + add dummy hops - pub fn new - (node_pks: &[PublicKey], keys_manager: &K, secp_ctx: &Secp256k1) -> Result + pub fn new + (node_pks: &[PublicKey], entropy_source: &ES, secp_ctx: &Secp256k1) -> Result { if node_pks.len() < 2 { return Err(()) } - let blinding_secret_bytes = keys_manager.get_secure_random_bytes(); + let blinding_secret_bytes = entropy_source.get_secure_random_bytes(); let blinding_secret = SecretKey::from_slice(&blinding_secret_bytes[..]).expect("RNG is busted"); let introduction_node_id = node_pks[0]; @@ -79,11 +79,11 @@ impl BlindedPath { } // Advance the blinded path by one hop, so make the second hop into the new introduction node. - pub(super) fn advance_by_one - (&mut self, keys_manager: &K, secp_ctx: &Secp256k1) -> Result<(), ()> - where K::Target: NodeSigner + pub(super) fn advance_by_one + (&mut self, node_signer: &NS, secp_ctx: &Secp256k1) -> Result<(), ()> + where NS::Target: NodeSigner { - let control_tlvs_ss = keys_manager.ecdh(Recipient::Node, &self.blinding_point, None)?; + let control_tlvs_ss = node_signer.ecdh(Recipient::Node, &self.blinding_point, None)?; let rho = onion_utils::gen_rho_from_shared_secret(&control_tlvs_ss.secret_bytes()); let encrypted_control_tlvs = self.blinded_hops.remove(0).encrypted_payload; let mut s = Cursor::new(&encrypted_control_tlvs);