File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -1206,6 +1206,20 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
1206
1206
self . inner . lock ( ) . unwrap ( ) . broadcast_latest_holder_commitment_txn ( broadcaster, logger) ;
1207
1207
}
1208
1208
1209
+ pub ( crate ) fn broadcast_latest_holder_commitment_txn_if_unspent < B : Deref , L : Deref > (
1210
+ & self ,
1211
+ broadcaster : & B ,
1212
+ logger : & L ,
1213
+ ) where
1214
+ B :: Target : BroadcasterInterface ,
1215
+ L :: Target : Logger ,
1216
+ {
1217
+ let mut locked_inner = self . inner . lock ( ) . unwrap ( ) ;
1218
+ if !locked_inner. detected_funding_spend ( ) {
1219
+ locked_inner. broadcast_latest_holder_commitment_txn ( broadcaster, logger) ;
1220
+ }
1221
+ }
1222
+
1209
1223
/// Updates a ChannelMonitor on the basis of some new information provided by the Channel
1210
1224
/// itself.
1211
1225
///
@@ -1236,11 +1250,6 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
1236
1250
self . inner . lock ( ) . unwrap ( ) . get_funding_txo ( ) . clone ( )
1237
1251
}
1238
1252
1239
- /// Gets whether we've seen a confirmed transaction spending the funding output.
1240
- pub ( crate ) fn detected_funding_spend ( & self ) -> bool {
1241
- self . inner . lock ( ) . unwrap ( ) . detected_funding_spend ( )
1242
- }
1243
-
1244
1253
/// Gets a list of txids, with their output scripts (in the order they appear in the
1245
1254
/// transaction), which we must learn about spends of via block_connected().
1246
1255
pub fn get_outputs_to_watch ( & self ) -> Vec < ( Txid , Vec < ( u32 , Script ) > ) > {
Original file line number Diff line number Diff line change @@ -7208,12 +7208,12 @@ where
7208
7208
}
7209
7209
7210
7210
for ( funding_txo, monitor) in args. channel_monitors . iter_mut ( ) {
7211
- // There's no need to broadcast our commitment transaction if we've seen one
7212
- // confirmed (even with 1 confirmation) as it'll be rejected as
7213
- // duplicate/conflicting.
7214
- if !funding_txo_set. contains ( funding_txo) && !monitor. detected_funding_spend ( ) {
7211
+ if !funding_txo_set. contains ( funding_txo) {
7215
7212
log_info ! ( args. logger, "Broadcasting latest holder commitment transaction for closed channel {}" , log_bytes!( funding_txo. to_channel_id( ) ) ) ;
7216
- monitor. broadcast_latest_holder_commitment_txn ( & args. tx_broadcaster , & args. logger ) ;
7213
+ // There's no need to broadcast our commitment transaction if
7214
+ // we've seen one confirmed (even with 1 confirmation) as it'll
7215
+ // be rejected as duplicate/conflicting.
7216
+ monitor. broadcast_latest_holder_commitment_txn_if_unspent ( & args. tx_broadcaster , & args. logger ) ;
7217
7217
}
7218
7218
}
7219
7219
You can’t perform that action at this time.
0 commit comments