From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Mon, 3 Sep 2018 21:44:57 +0000 (-0400) Subject: Merge pull request #143 from TheBlueMatt/2018-08-announcement_sigs_erroraction X-Git-Tag: v0.0.12~331 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=5fb2cc4699410fedc1c4597ae216122b68dcd671;p=rust-lightning Merge pull request #143 from TheBlueMatt/2018-08-announcement_sigs_erroraction Ensure handle_announcement_signatures always has a ErrorAction --- 5fb2cc4699410fedc1c4597ae216122b68dcd671 diff --cc src/ln/channelmanager.rs index b1d81695b,b2f2347b4..dfe246d54 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@@ -475,9 -474,10 +474,9 @@@ impl ChannelManager // can only fail if an intermediary hop has an invalid public key or session_priv is invalid #[inline] - fn construct_onion_keys_callback (secp_ctx: &Secp256k1, route: &Route, session_priv: &SecretKey, mut callback: FType) -> Result<(), HandleError> { + fn construct_onion_keys_callback (secp_ctx: &Secp256k1, route: &Route, session_priv: &SecretKey, mut callback: FType) -> Result<(), secp256k1::Error> { let mut blinded_priv = session_priv.clone(); let mut blinded_pub = PublicKey::from_secret_key(secp_ctx, &blinded_priv); - let mut first_iteration = true; for hop in route.hops.iter() { let shared_secret = SharedSecret::new(secp_ctx, &hop.pubkey, &blinded_priv); @@@ -488,9 -488,13 +487,9 @@@ let mut blinding_factor = [0u8; 32]; sha.result(&mut blinding_factor); - if first_iteration { - blinded_pub = PublicKey::from_secret_key(secp_ctx, &blinded_priv); - first_iteration = false; - } let ephemeral_pubkey = blinded_pub; - secp_call!(blinded_priv.mul_assign(secp_ctx, &secp_call!(SecretKey::from_slice(secp_ctx, &blinding_factor)))); + blinded_priv.mul_assign(secp_ctx, &SecretKey::from_slice(secp_ctx, &blinding_factor)?)?; blinded_pub = PublicKey::from_secret_key(secp_ctx, &blinded_priv); callback(shared_secret, blinding_factor, ephemeral_pubkey, hop);