@@ -2394,6 +2394,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider  {
23942394				self.latest_monitor_update_id = CLOSED_CHANNEL_UPDATE_ID;
23952395				Some((self.get_counterparty_node_id(), funding_txo, ChannelMonitorUpdate {
23962396					update_id: self.latest_monitor_update_id,
2397+ 					counterparty_node_id: Some(self.counterparty_node_id),
23972398					updates: vec![ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast }],
23982399				}))
23992400			} else { None }
@@ -2766,6 +2767,7 @@ impl<SP: Deref> Channel<SP> where
27662767		self.context.latest_monitor_update_id += 1;
27672768		let monitor_update = ChannelMonitorUpdate {
27682769			update_id: self.context.latest_monitor_update_id,
2770+ 			counterparty_node_id: Some(self.context.counterparty_node_id),
27692771			updates: vec![ChannelMonitorUpdateStep::PaymentPreimage {
27702772				payment_preimage: payment_preimage_arg.clone(),
27712773			}],
@@ -2997,6 +2999,20 @@ impl<SP: Deref> Channel<SP> where
29972999		self.context.channel_state.clear_waiting_for_batch();
29983000	}
29993001
3002+ 	/// Unsets the existing funding information.
3003+ 	///
3004+ 	/// This must only be used if the channel has not yet completed funding and has not been used.
3005+ 	///
3006+ 	/// Further, the channel must be immediately shut down after this with a call to
3007+ 	/// [`ChannelContext::force_shutdown`].
3008+ 	pub fn unset_funding_info(&mut self, temporary_channel_id: ChannelId) {
3009+ 		debug_assert!(matches!(
3010+ 			self.context.channel_state, ChannelState::AwaitingChannelReady(_)
3011+ 		));
3012+ 		self.context.channel_transaction_parameters.funding_outpoint = None;
3013+ 		self.context.channel_id = temporary_channel_id;
3014+ 	}
3015+ 
30003016	/// Handles a channel_ready message from our peer. If we've already sent our channel_ready
30013017	/// and the channel is now usable (and public), this may generate an announcement_signatures to
30023018	/// reply with.
@@ -3487,6 +3503,7 @@ impl<SP: Deref> Channel<SP> where
34873503		self.context.latest_monitor_update_id += 1;
34883504		let mut monitor_update = ChannelMonitorUpdate {
34893505			update_id: self.context.latest_monitor_update_id,
3506+ 			counterparty_node_id: Some(self.context.counterparty_node_id),
34903507			updates: vec![ChannelMonitorUpdateStep::LatestHolderCommitmentTXInfo {
34913508				commitment_tx: holder_commitment_tx,
34923509				htlc_outputs: htlcs_and_sigs,
@@ -3566,6 +3583,7 @@ impl<SP: Deref> Channel<SP> where
35663583
35673584			let mut monitor_update = ChannelMonitorUpdate {
35683585				update_id: self.context.latest_monitor_update_id + 1, // We don't increment this yet!
3586+ 				counterparty_node_id: Some(self.context.counterparty_node_id),
35693587				updates: Vec::new(),
35703588			};
35713589
@@ -3746,6 +3764,7 @@ impl<SP: Deref> Channel<SP> where
37463764		self.context.latest_monitor_update_id += 1;
37473765		let mut monitor_update = ChannelMonitorUpdate {
37483766			update_id: self.context.latest_monitor_update_id,
3767+ 			counterparty_node_id: Some(self.context.counterparty_node_id),
37493768			updates: vec![ChannelMonitorUpdateStep::CommitmentSecret {
37503769				idx: self.context.cur_counterparty_commitment_transaction_number + 1,
37513770				secret: msg.per_commitment_secret,
@@ -4803,6 +4822,7 @@ impl<SP: Deref> Channel<SP> where
48034822			self.context.latest_monitor_update_id += 1;
48044823			let monitor_update = ChannelMonitorUpdate {
48054824				update_id: self.context.latest_monitor_update_id,
4825+ 				counterparty_node_id: Some(self.context.counterparty_node_id),
48064826				updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
48074827					scriptpubkey: self.get_closing_scriptpubkey(),
48084828				}],
@@ -5926,6 +5946,7 @@ impl<SP: Deref> Channel<SP> where
59265946		self.context.latest_monitor_update_id += 1;
59275947		let monitor_update = ChannelMonitorUpdate {
59285948			update_id: self.context.latest_monitor_update_id,
5949+ 			counterparty_node_id: Some(self.context.counterparty_node_id),
59295950			updates: vec![ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
59305951				commitment_txid: counterparty_commitment_txid,
59315952				htlc_outputs: htlcs.clone(),
@@ -6124,6 +6145,7 @@ impl<SP: Deref> Channel<SP> where
61246145			self.context.latest_monitor_update_id += 1;
61256146			let monitor_update = ChannelMonitorUpdate {
61266147				update_id: self.context.latest_monitor_update_id,
6148+ 				counterparty_node_id: Some(self.context.counterparty_node_id),
61276149				updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
61286150					scriptpubkey: self.get_closing_scriptpubkey(),
61296151				}],
0 commit comments