Skip to content

Commit ad4fba9

Browse files
committed
Add Counterparty ChannelMonitorUpdateStep variant
1 parent f3d5b94 commit ad4fba9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ pub(crate) enum ChannelMonitorUpdateStep {
471471
ShutdownScript {
472472
scriptpubkey: Script,
473473
},
474+
Counterparty {
475+
counterparty_node_id: PublicKey,
476+
}
474477
}
475478

476479
impl ChannelMonitorUpdateStep {
@@ -482,6 +485,7 @@ impl ChannelMonitorUpdateStep {
482485
ChannelMonitorUpdateStep::CommitmentSecret { .. } => "CommitmentSecret",
483486
ChannelMonitorUpdateStep::ChannelForceClosed { .. } => "ChannelForceClosed",
484487
ChannelMonitorUpdateStep::ShutdownScript { .. } => "ShutdownScript",
488+
ChannelMonitorUpdateStep::Counterparty { .. } => "Counterparty",
485489
}
486490
}
487491
}
@@ -510,6 +514,9 @@ impl_writeable_tlv_based_enum_upgradable!(ChannelMonitorUpdateStep,
510514
(5, ShutdownScript) => {
511515
(0, scriptpubkey, required),
512516
},
517+
(6, Counterparty) => {
518+
(0, counterparty_node_id, required)
519+
}
513520
);
514521

515522
/// Details about the balance(s) available for spending once the channel appears on chain.
@@ -2005,6 +2012,9 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
20052012
panic!("Attempted to replace shutdown script {} with {}", shutdown_script, scriptpubkey);
20062013
}
20072014
},
2015+
ChannelMonitorUpdateStep::Counterparty { counterparty_node_id } => {
2016+
log_trace!(logger, "Updating ChannelMonitor with counterparty_node_id {}", counterparty_node_id);
2017+
}
20082018
}
20092019
}
20102020
self.latest_update_id = updates.update_id;

lightning/src/ln/channel.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,6 +4187,8 @@ impl<Signer: Sign> Channel<Signer> {
41874187
update_id: self.latest_monitor_update_id,
41884188
updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
41894189
scriptpubkey: self.get_closing_scriptpubkey(),
4190+
}, ChannelMonitorUpdateStep::Counterparty {
4191+
counterparty_node_id: self.counterparty_node_id,
41904192
}],
41914193
})
41924194
} else { None };
@@ -5730,6 +5732,8 @@ impl<Signer: Sign> Channel<Signer> {
57305732
update_id: self.latest_monitor_update_id,
57315733
updates: vec![ChannelMonitorUpdateStep::ShutdownScript {
57325734
scriptpubkey: self.get_closing_scriptpubkey(),
5735+
}, ChannelMonitorUpdateStep::Counterparty {
5736+
counterparty_node_id: self.counterparty_node_id,
57335737
}],
57345738
})
57355739
} else { None };

0 commit comments

Comments
 (0)