Skip to content

Commit 492b240

Browse files
committed
Track whether HolderFundingOutput originated from an anchor channel
1 parent 519ec90 commit 492b240

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
28842884

28852885
let should_broadcast = self.should_broadcast_holder_commitment_txn(logger);
28862886
if should_broadcast {
2887-
let funding_outp = HolderFundingOutput::build(self.funding_redeemscript.clone());
2887+
let funding_outp = HolderFundingOutput::build(self.funding_redeemscript.clone(), self.onchain_tx_handler.opt_anchors());
28882888
let commitment_package = PackageTemplate::build_package(self.funding_info.0.txid.clone(), self.funding_info.0.index as u32, PackageSolvingData::HolderFundingOutput(funding_outp), self.best_block.height(), false, self.best_block.height());
28892889
claimable_outpoints.push(commitment_package);
28902890
self.pending_monitor_events.push(MonitorEvent::CommitmentTxConfirmed(self.funding_info.0));

lightning/src/chain/package.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,26 @@ impl_writeable_tlv_based!(HolderHTLCOutput, {
286286
#[derive(Clone, PartialEq, Eq)]
287287
pub(crate) struct HolderFundingOutput {
288288
funding_redeemscript: Script,
289+
opt_anchors: Option<()>,
289290
}
290291

292+
291293
impl HolderFundingOutput {
292-
pub(crate) fn build(funding_redeemscript: Script) -> Self {
294+
pub(crate) fn build(funding_redeemscript: Script, opt_anchors: bool) -> Self {
293295
HolderFundingOutput {
294296
funding_redeemscript,
297+
opt_anchors: if opt_anchors { Some(()) } else { None },
295298
}
296299
}
300+
301+
fn opt_anchors(&self) -> bool {
302+
self.opt_anchors.is_some()
303+
}
297304
}
298305

299306
impl_writeable_tlv_based!(HolderFundingOutput, {
300307
(0, funding_redeemscript, required),
308+
(1, opt_anchors, option),
301309
});
302310

303311
/// A wrapper encapsulating all in-protocol differing outputs types.

0 commit comments

Comments
 (0)