@@ -1202,6 +1202,19 @@ pub(crate) struct ChannelMonitorImpl<Signer: EcdsaChannelSigner> {
12021202funding : FundingScope ,
12031203pending_funding : Vec < FundingScope > ,
12041204
1205+ /// True if this channel was configured for manual funding broadcasts. Monitors written by
1206+ /// versions prior to LDK 0.2 load with `false` until a new update persists it.
1207+ is_manual_broadcast : bool ,
1208+ /// True once we've observed either funding transaction on-chain. Older monitors prior to LDK 0.2
1209+ /// assume this is `true` when absent during upgrade so holder broadcasts aren't gated unexpectedly.
1210+ /// In manual-broadcast channels we also use this to trigger deferred holder
1211+ /// broadcasts once the funding transaction finally appears on-chain.
1212+ ///
1213+ /// Note: This tracks whether the funding transaction was ever broadcast, not whether it is
1214+ /// currently confirmed. It is never reset, even if the funding transaction is unconfirmed due
1215+ /// to a reorg.
1216+ funding_seen_onchain : bool ,
1217+
12051218latest_update_id : u64 ,
12061219commitment_transaction_number_obscure_factor : u64 ,
12071220
@@ -1740,6 +1753,8 @@ pub(crate) fn write_chanmon_internal<Signer: EcdsaChannelSigner, W: Writer>(
17401753( 32 , channel_monitor. pending_funding, optional_vec) ,
17411754( 33 , channel_monitor. htlcs_resolved_to_user, required) ,
17421755( 34 , channel_monitor. alternative_funding_confirmed, option) ,
1756+ ( 35 , channel_monitor. is_manual_broadcast, required) ,
1757+ ( 37 , channel_monitor. funding_seen_onchain, required) ,
17431758} ) ;
17441759
17451760Ok ( ( ) )
@@ -1868,6 +1883,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
18681883commitment_transaction_number_obscure_factor : u64 ,
18691884initial_holder_commitment_tx : HolderCommitmentTransaction , best_block : BestBlock ,
18701885counterparty_node_id : PublicKey , channel_id : ChannelId ,
1886+ is_manual_broadcast : bool ,
18711887) -> ChannelMonitor < Signer > {
18721888
18731889assert ! ( commitment_transaction_number_obscure_factor <= ( 1 << 48 ) ) ;
@@ -1914,6 +1930,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
19141930} ,
19151931pending_funding : vec ! [ ] ,
19161932
1933+ is_manual_broadcast,
1934+ funding_seen_onchain : false ,
1935+
19171936latest_update_id : 0 ,
19181937commitment_transaction_number_obscure_factor,
19191938
@@ -6562,6 +6581,8 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
65626581let mut channel_parameters = None ;
65636582let mut pending_funding = None ;
65646583let mut alternative_funding_confirmed = None ;
6584+ let mut is_manual_broadcast = RequiredWrapper ( None ) ;
6585+ let mut funding_seen_onchain = RequiredWrapper ( None ) ;
65656586read_tlv_fields ! ( reader, {
65666587( 1 , funding_spend_confirmed, option) ,
65676588( 3 , htlcs_resolved_on_chain, optional_vec) ,
@@ -6582,6 +6603,8 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
65826603( 32 , pending_funding, optional_vec) ,
65836604( 33 , htlcs_resolved_to_user, option) ,
65846605( 34 , alternative_funding_confirmed, option) ,
6606+ ( 35 , is_manual_broadcast, ( default_value, false ) ) ,
6607+ ( 37 , funding_seen_onchain, ( default_value, true ) ) ,
65856608} ) ;
65866609// Note that `payment_preimages_with_info` was added (and is always written) in LDK 0.1, so
65876610// we can use it to determine if this monitor was last written by LDK 0.1 or later.
@@ -6695,6 +6718,10 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
66956718prev_holder_commitment_tx,
66966719} ,
66976720pending_funding : pending_funding. unwrap_or ( vec ! [ ] ) ,
6721+ is_manual_broadcast : is_manual_broadcast. 0 . unwrap ( ) ,
6722+ // Older monitors prior to LDK 0.2 assume this is `true` when absent
6723+ // during upgrade so holder broadcasts aren't gated unexpectedly.
6724+ funding_seen_onchain : funding_seen_onchain. 0 . unwrap ( ) ,
66986725
66996726latest_update_id,
67006727commitment_transaction_number_obscure_factor,
0 commit comments