From df7adb672b1fa80662ad5901765500b0f2fe536c Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 2 May 2020 22:07:44 -0400 Subject: [PATCH] f refactor out inline if into a local variable --- lightning/src/ln/channel.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index be45952c3..d9327dd55 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -977,11 +977,14 @@ impl Channel { if value_to_b >= (dust_limit_satoshis as i64) { log_trace!(self, " ...including {} output with value {}", if local { "to_remote" } else { "to_local" }, value_to_b); + let static_payment_pk_hash = WPubkeyHash::hash(&if local { + self.their_pubkeys.as_ref().unwrap().payment_basepoint + } else { + self.local_keys.pubkeys().payment_basepoint + }.serialize()); txouts.push((TxOut { script_pubkey: Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0) - .push_slice(&WPubkeyHash::hash(&if local { - self.their_pubkeys.as_ref().unwrap().payment_basepoint - } else { self.local_keys.pubkeys().payment_basepoint }.serialize())[..]) + .push_slice(&static_payment_pk_hash[..]) .into_script(), value: value_to_b as u64 }, None)); -- 2.39.5