@@ -2394,6 +2394,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
2394
2394
self.latest_monitor_update_id = CLOSED_CHANNEL_UPDATE_ID;
2395
2395
Some((self.get_counterparty_node_id(), funding_txo, ChannelMonitorUpdate {
2396
2396
update_id: self.latest_monitor_update_id,
2397
+ counterparty_node_id: Some(self.counterparty_node_id),
2397
2398
updates: vec![ChannelMonitorUpdateStep::ChannelForceClosed { should_broadcast }],
2398
2399
}))
2399
2400
} else { None }
@@ -2766,6 +2767,7 @@ impl<SP: Deref> Channel<SP> where
2766
2767
self.context.latest_monitor_update_id += 1;
2767
2768
let monitor_update = ChannelMonitorUpdate {
2768
2769
update_id: self.context.latest_monitor_update_id,
2770
+ counterparty_node_id: Some(self.context.counterparty_node_id),
2769
2771
updates: vec![ChannelMonitorUpdateStep::PaymentPreimage {
2770
2772
payment_preimage: payment_preimage_arg.clone(),
2771
2773
}],
@@ -2997,6 +2999,20 @@ impl<SP: Deref> Channel<SP> where
2997
2999
self.context.channel_state.clear_waiting_for_batch();
2998
3000
}
2999
3001
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
+
3000
3016
/// Handles a channel_ready message from our peer. If we've already sent our channel_ready
3001
3017
/// and the channel is now usable (and public), this may generate an announcement_signatures to
3002
3018
/// reply with.
@@ -3487,6 +3503,7 @@ impl<SP: Deref> Channel<SP> where
3487
3503
self.context.latest_monitor_update_id += 1;
3488
3504
let mut monitor_update = ChannelMonitorUpdate {
3489
3505
update_id: self.context.latest_monitor_update_id,
3506
+ counterparty_node_id: Some(self.context.counterparty_node_id),
3490
3507
updates: vec![ChannelMonitorUpdateStep::LatestHolderCommitmentTXInfo {
3491
3508
commitment_tx: holder_commitment_tx,
3492
3509
htlc_outputs: htlcs_and_sigs,
@@ -3566,6 +3583,7 @@ impl<SP: Deref> Channel<SP> where
3566
3583
3567
3584
let mut monitor_update = ChannelMonitorUpdate {
3568
3585
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),
3569
3587
updates: Vec::new(),
3570
3588
};
3571
3589
@@ -3746,6 +3764,7 @@ impl<SP: Deref> Channel<SP> where
3746
3764
self.context.latest_monitor_update_id += 1;
3747
3765
let mut monitor_update = ChannelMonitorUpdate {
3748
3766
update_id: self.context.latest_monitor_update_id,
3767
+ counterparty_node_id: Some(self.context.counterparty_node_id),
3749
3768
updates: vec![ChannelMonitorUpdateStep::CommitmentSecret {
3750
3769
idx: self.context.cur_counterparty_commitment_transaction_number + 1,
3751
3770
secret: msg.per_commitment_secret,
@@ -4803,6 +4822,7 @@ impl<SP: Deref> Channel<SP> where
4803
4822
self.context.latest_monitor_update_id += 1;
4804
4823
let monitor_update = ChannelMonitorUpdate {
4805
4824
update_id: self.context.latest_monitor_update_id,
4825
+ counterparty_node_id: Some(self.context.counterparty_node_id),
4806
4826
updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
4807
4827
scriptpubkey: self.get_closing_scriptpubkey(),
4808
4828
}],
@@ -5926,6 +5946,7 @@ impl<SP: Deref> Channel<SP> where
5926
5946
self.context.latest_monitor_update_id += 1;
5927
5947
let monitor_update = ChannelMonitorUpdate {
5928
5948
update_id: self.context.latest_monitor_update_id,
5949
+ counterparty_node_id: Some(self.context.counterparty_node_id),
5929
5950
updates: vec![ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
5930
5951
commitment_txid: counterparty_commitment_txid,
5931
5952
htlc_outputs: htlcs.clone(),
@@ -6124,6 +6145,7 @@ impl<SP: Deref> Channel<SP> where
6124
6145
self.context.latest_monitor_update_id += 1;
6125
6146
let monitor_update = ChannelMonitorUpdate {
6126
6147
update_id: self.context.latest_monitor_update_id,
6148
+ counterparty_node_id: Some(self.context.counterparty_node_id),
6127
6149
updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
6128
6150
scriptpubkey: self.get_closing_scriptpubkey(),
6129
6151
}],
0 commit comments