]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Unwrap unneeded macros
authorDevrandom <c1.devrandom@niftybox.net>
Mon, 19 Oct 2020 08:27:18 +0000 (10:27 +0200)
committerDevrandom <c1.devrandom@niftybox.net>
Fri, 18 Dec 2020 23:31:51 +0000 (15:31 -0800)
lightning/src/ln/channel.rs

index abf2834c26a93d6b020ea095959014c08c963642..594ef38e7224cfaeb416784ca43f4973cb2cf241 100644 (file)
@@ -1555,22 +1555,16 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
                let counterparty_pubkeys = self.counterparty_pubkeys.as_ref().unwrap();
                let funding_redeemscript = self.get_funding_redeemscript();
                let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
-               macro_rules! create_monitor {
-                       () => { {
-                               let mut channel_monitor = ChannelMonitor::new(self.holder_keys.clone(),
-                                                                             &self.shutdown_pubkey, self.holder_selected_contest_delay,
-                                                                             &self.destination_script, (funding_txo, funding_txo_script.clone()),
-                                                                             &counterparty_pubkeys.htlc_basepoint, &counterparty_pubkeys.delayed_payment_basepoint,
-                                                                             self.counterparty_selected_contest_delay, funding_redeemscript.clone(), self.channel_value_satoshis,
-                                                                             self.get_commitment_transaction_number_obscure_factor(),
-                                                                             initial_commitment_tx.clone());
-
-                               channel_monitor.provide_latest_counterparty_commitment_tx_info(&counterparty_initial_commitment_tx, Vec::new(), self.cur_counterparty_commitment_transaction_number, self.counterparty_cur_commitment_point.unwrap(), logger);
-                               channel_monitor
-                       } }
-               }
+               let mut channel_monitor = ChannelMonitor::new(self.holder_keys.clone(),
+                                                             &self.shutdown_pubkey, self.holder_selected_contest_delay,
+                                                             &self.destination_script, (funding_txo, funding_txo_script.clone()),
+                                                             &counterparty_pubkeys.htlc_basepoint, &counterparty_pubkeys.delayed_payment_basepoint,
+                                                             self.counterparty_selected_contest_delay, funding_redeemscript.clone(), self.channel_value_satoshis,
+                                                             self.get_commitment_transaction_number_obscure_factor(),
+
+                                                             initial_commitment_tx.clone());
 
-               let channel_monitor = create_monitor!();
+               channel_monitor.provide_latest_counterparty_commitment_tx_info(&counterparty_initial_commitment_tx, Vec::new(), self.cur_counterparty_commitment_transaction_number, self.counterparty_cur_commitment_point.unwrap(), logger);
 
                self.channel_state = ChannelState::FundingSent as u32;
                self.channel_id = funding_txo.to_channel_id();
@@ -1618,24 +1612,17 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
                let funding_redeemscript = self.get_funding_redeemscript();
                let funding_txo = self.funding_txo.as_ref().unwrap();
                let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
-               macro_rules! create_monitor {
-                       () => { {
-                               let commitment_tx = HolderCommitmentTransaction::new_missing_holder_sig(initial_commitment_tx.clone(), msg.signature.clone(), &self.holder_keys.pubkeys().funding_pubkey, counterparty_funding_pubkey, holder_keys.clone(), self.feerate_per_kw, Vec::new());
-                               let mut channel_monitor = ChannelMonitor::new(self.holder_keys.clone(),
-                                                                             &self.shutdown_pubkey, self.holder_selected_contest_delay,
-                                                                             &self.destination_script, (funding_txo.clone(), funding_txo_script.clone()),
-                                                                             &counterparty_pubkeys.htlc_basepoint, &counterparty_pubkeys.delayed_payment_basepoint,
-                                                                             self.counterparty_selected_contest_delay, funding_redeemscript.clone(), self.channel_value_satoshis,
-                                                                             self.get_commitment_transaction_number_obscure_factor(),
-                                                                             commitment_tx);
-
-                               channel_monitor.provide_latest_counterparty_commitment_tx_info(&counterparty_initial_commitment_tx, Vec::new(), self.cur_counterparty_commitment_transaction_number, self.counterparty_cur_commitment_point.unwrap(), logger);
-
-                               channel_monitor
-                       } }
-               }
+               let commitment_tx = HolderCommitmentTransaction::new_missing_holder_sig(initial_commitment_tx.clone(), msg.signature.clone(), &self.holder_keys.pubkeys().funding_pubkey, counterparty_funding_pubkey, holder_keys.clone(), self.feerate_per_kw, Vec::new());
+               let mut channel_monitor = ChannelMonitor::new(self.holder_keys.clone(),
+                                                             &self.shutdown_pubkey, self.holder_selected_contest_delay,
+                                                             &self.destination_script, (funding_txo.clone(), funding_txo_script.clone()),
+                                                             &counterparty_pubkeys.htlc_basepoint, &counterparty_pubkeys.delayed_payment_basepoint,
+                                                             self.counterparty_selected_contest_delay, funding_redeemscript.clone(), self.channel_value_satoshis,
+                                                             self.get_commitment_transaction_number_obscure_factor(),
+
+                                                             commitment_tx);
 
-               let channel_monitor = create_monitor!();
+               channel_monitor.provide_latest_counterparty_commitment_tx_info(&counterparty_initial_commitment_tx, Vec::new(), self.cur_counterparty_commitment_transaction_number, self.counterparty_cur_commitment_point.unwrap(), logger);
 
                assert_eq!(self.channel_state & (ChannelState::MonitorUpdateFailed as u32), 0); // We have no had any monitor(s) yet to fail update!
                self.channel_state = ChannelState::FundingSent as u32;