X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Fsrc%2Fonion_message.rs;h=9ac86c34582cef597db6ef517d6e9516aba6543d;hb=ec3de62bc754ea6cf512488415b6e787e58e7337;hp=3075a54b60de7a623d612351b3c815cd57cfc42f;hpb=5824e226cad67e32d5e8be71ebbb6f91a3fc2116;p=rust-lightning diff --git a/fuzz/src/onion_message.rs b/fuzz/src/onion_message.rs index 3075a54b..9ac86c34 100644 --- a/fuzz/src/onion_message.rs +++ b/fuzz/src/onion_message.rs @@ -30,7 +30,7 @@ pub fn do_test(data: &[u8], logger: &L) { counter: AtomicU64::new(0), }; let custom_msg_handler = TestCustomMessageHandler {}; - let onion_messenger = OnionMessenger::new(&keys_manager, logger, &custom_msg_handler); + let onion_messenger = OnionMessenger::new(&keys_manager, &keys_manager, logger, &custom_msg_handler); let mut pk = [2; 33]; pk[1] = 0xff; let peer_node_id_not_used = PublicKey::from_slice(&pk).unwrap(); onion_messenger.handle_onion_message(&peer_node_id_not_used, &msg); @@ -100,17 +100,19 @@ impl EntropySource for KeyProvider { } impl NodeSigner for KeyProvider { - fn get_node_secret(&self, _recipient: Recipient) -> Result { - Ok(self.node_secret.clone()) - } - fn get_node_id(&self, recipient: Recipient) -> Result { - let secp_ctx = Secp256k1::signing_only(); - Ok(PublicKey::from_secret_key(&secp_ctx, &self.get_node_secret(recipient)?)) + let node_secret = match recipient { + Recipient::Node => Ok(&self.node_secret), + Recipient::PhantomNode => Err(()) + }?; + Ok(PublicKey::from_secret_key(&Secp256k1::signing_only(), node_secret)) } fn ecdh(&self, recipient: Recipient, other_key: &PublicKey, tweak: Option<&Scalar>) -> Result { - let mut node_secret = self.get_node_secret(recipient)?; + let mut node_secret = match recipient { + Recipient::Node => Ok(self.node_secret.clone()), + Recipient::PhantomNode => Err(()) + }?; if let Some(tweak) = tweak { node_secret = node_secret.mul_tweak(tweak).map_err(|_| ())?; } @@ -122,6 +124,10 @@ impl NodeSigner for KeyProvider { fn sign_invoice(&self, _hrp_bytes: &[u8], _invoice_data: &[u5], _recipient: Recipient) -> Result { unreachable!() } + + fn sign_gossip_message(&self, _msg: lightning::ln::msgs::UnsignedGossipMessage) -> Result { + unreachable!() + } } impl SignerProvider for KeyProvider { @@ -135,9 +141,9 @@ impl SignerProvider for KeyProvider { fn read_chan_signer(&self, _data: &[u8]) -> Result { unreachable!() } - fn get_destination_script(&self) -> Script { unreachable!() } + fn get_destination_script(&self) -> Result { unreachable!() } - fn get_shutdown_scriptpubkey(&self) -> ShutdownScript { unreachable!() } + fn get_shutdown_scriptpubkey(&self) -> Result { unreachable!() } } #[cfg(test)]