Skip to content

Commit df7adb6

Browse files
committed
f refactor out inline if into a local variable
1 parent 2801919 commit df7adb6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,11 +977,14 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
977977

978978
if value_to_b >= (dust_limit_satoshis as i64) {
979979
log_trace!(self, " ...including {} output with value {}", if local { "to_remote" } else { "to_local" }, value_to_b);
980+
let static_payment_pk_hash = WPubkeyHash::hash(&if local {
981+
self.their_pubkeys.as_ref().unwrap().payment_basepoint
982+
} else {
983+
self.local_keys.pubkeys().payment_basepoint
984+
}.serialize());
980985
txouts.push((TxOut {
981986
script_pubkey: Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0)
982-
.push_slice(&WPubkeyHash::hash(&if local {
983-
self.their_pubkeys.as_ref().unwrap().payment_basepoint
984-
} else { self.local_keys.pubkeys().payment_basepoint }.serialize())[..])
987+
.push_slice(&static_payment_pk_hash[..])
985988
.into_script(),
986989
value: value_to_b as u64
987990
}, None));

0 commit comments

Comments
 (0)