From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:59:13 +0000 (+0000) Subject: Merge pull request #2691 from wpaulino/refactor-channel-state X-Git-Tag: v0.0.119~22 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=61994066f849882adb82ecb0c4881d31b303c221;p=rust-lightning Merge pull request #2691 from wpaulino/refactor-channel-state Refactor ChannelState to decouple state flags from states --- 61994066f849882adb82ecb0c4881d31b303c221 diff --cc lightning/src/ln/channel.rs index 117986acf,5a49b6807..8d6144fc2 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@@ -2789,13 -3018,13 +3017,13 @@@ impl Channel wher self.context.counterparty_cur_commitment_point.unwrap(), counterparty_initial_commitment_tx.feerate_per_kw(), counterparty_initial_commitment_tx.to_broadcaster_value_sat(), - counterparty_initial_commitment_tx.to_countersignatory_value_sat(), &&logger_with_chan_monitor); + counterparty_initial_commitment_tx.to_countersignatory_value_sat(), logger); - assert_eq!(self.context.channel_state & (ChannelState::MonitorUpdateInProgress as u32), 0); // We have no had any monitor(s) yet to fail update! + assert!(!self.context.channel_state.is_monitor_update_in_progress()); // We have no had any monitor(s) yet to fail update! if self.context.is_batch_funding() { - self.context.channel_state = ChannelState::FundingSent as u32 | ChannelState::WaitingForBatch as u32; + self.context.channel_state = ChannelState::AwaitingChannelReady(AwaitingChannelReadyFlags::WAITING_FOR_BATCH); } else { - self.context.channel_state = ChannelState::FundingSent as u32; + self.context.channel_state = ChannelState::AwaitingChannelReady(AwaitingChannelReadyFlags::new()); } self.context.cur_holder_commitment_transaction_number -= 1; self.context.cur_counterparty_commitment_transaction_number -= 1;