From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Sun, 19 Apr 2020 00:19:21 +0000 (+0000) Subject: Merge pull request #558 from TheBlueMatt/2020-03-555-nits X-Git-Tag: v0.0.12~83 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=commitdiff_plain;h=b9db2ec687b8c570ad9b8e938049c5b330433b68;hp=02c1925c16fca0a5c37582ec70b3fe48ba076f8f Merge pull request #558 from TheBlueMatt/2020-03-555-nits Flatten ChannelMonitor substructs that don't add clarity --- diff --git a/lightning/src/ln/channelmonitor.rs b/lightning/src/ln/channelmonitor.rs index cba28982..e88dd333 100644 --- a/lightning/src/ln/channelmonitor.rs +++ b/lightning/src/ln/channelmonitor.rs @@ -290,7 +290,7 @@ impl return Err(MonitorUpdateError("Channel monitor for given key is already present")), hash_map::Entry::Vacant(e) => e, }; - match monitor.onchain_detection.funding_info { + match monitor.funding_info { None => { return Err(MonitorUpdateError("Try to update a useless monitor without funding_txo !")); }, @@ -314,7 +314,7 @@ impl { - log_trace!(self, "Updating Channel Monitor for channel {}", log_funding_info!(orig_monitor.onchain_detection)); + log_trace!(self, "Updating Channel Monitor for channel {}", log_funding_info!(orig_monitor)); orig_monitor.update_monitor(update, &self.broadcaster) }, None => Err(MonitorUpdateError("No such monitor registered")) @@ -391,20 +391,6 @@ pub(crate) const LATENCY_GRACE_PERIOD_BLOCKS: u32 = 3; /// keeping bumping another claim tx to solve the outpoint. pub(crate) const ANTI_REORG_DELAY: u32 = 6; -struct OnchainDetection { - keys: ChanSigner, - funding_info: Option<(OutPoint, Script)>, - current_remote_commitment_txid: Option, - prev_remote_commitment_txid: Option, -} - -#[cfg(any(test, feature = "fuzztarget"))] -impl PartialEq for OnchainDetection { - fn eq(&self, other: &Self) -> bool { - self.keys.pubkeys() == other.keys.pubkeys() - } -} - #[derive(Clone, PartialEq)] struct LocalSignedTx { /// txid of the transaction in tx, just used to make comparison faster @@ -734,7 +720,11 @@ pub struct ChannelMonitor { broadcasted_remote_payment_script: Option<(Script, SecretKey)>, shutdown_script: Script, - onchain_detection: OnchainDetection, + keys: ChanSigner, + funding_info: Option<(OutPoint, Script)>, + current_remote_commitment_txid: Option, + prev_remote_commitment_txid: Option, + their_htlc_base_key: Option, their_delayed_payment_base_key: Option, funding_redeemscript: Option