@@ -1294,16 +1294,16 @@ impl ChannelMonitor {
1294
1294
/// Attempts to claim any claimable HTLCs in a commitment transaction which was not (yet)
1295
1295
/// revoked using data in local_claimable_outpoints.
1296
1296
/// Should not be used if check_spend_revoked_transaction succeeds.
1297
- fn check_spend_local_transaction ( & self , tx : & Transaction , _height : u32 ) -> ( Vec < Transaction > , Vec < SpendableOutputDescriptor > ) {
1297
+ fn check_spend_local_transaction ( & self , tx : & Transaction , _height : u32 ) -> ( ( Vec < Transaction > , Vec < SpendableOutputDescriptor > ) , ( Sha256dHash , Vec < TxOut > ) ) {
1298
1298
let commitment_txid = tx. txid ( ) ;
1299
1299
if let & Some ( ref local_tx) = & self . current_local_signed_commitment_tx {
1300
1300
if local_tx. txid == commitment_txid {
1301
1301
match self . key_storage {
1302
1302
KeyStorage :: PrivMode { revocation_base_key : _, htlc_base_key : _, ref delayed_payment_base_key, prev_latest_per_commitment_point : _, ref latest_per_commitment_point } => {
1303
- return self . broadcast_by_local_state ( local_tx, latest_per_commitment_point, & Some ( * delayed_payment_base_key) ) ;
1303
+ return ( self . broadcast_by_local_state ( local_tx, latest_per_commitment_point, & Some ( * delayed_payment_base_key) ) , ( commitment_txid , tx . output . clone ( ) ) ) ;
1304
1304
} ,
1305
1305
KeyStorage :: SigsMode { .. } => {
1306
- return self . broadcast_by_local_state ( local_tx, & None , & None ) ;
1306
+ return ( self . broadcast_by_local_state ( local_tx, & None , & None ) , ( commitment_txid , tx . output . clone ( ) ) ) ;
1307
1307
}
1308
1308
}
1309
1309
}
@@ -1312,15 +1312,15 @@ impl ChannelMonitor {
1312
1312
if local_tx. txid == commitment_txid {
1313
1313
match self . key_storage {
1314
1314
KeyStorage :: PrivMode { revocation_base_key : _, htlc_base_key : _, ref delayed_payment_base_key, ref prev_latest_per_commitment_point, .. } => {
1315
- return self . broadcast_by_local_state ( local_tx, prev_latest_per_commitment_point, & Some ( * delayed_payment_base_key) ) ;
1315
+ return ( self . broadcast_by_local_state ( local_tx, prev_latest_per_commitment_point, & Some ( * delayed_payment_base_key) ) , ( commitment_txid , tx . output . clone ( ) ) ) ;
1316
1316
} ,
1317
1317
KeyStorage :: SigsMode { .. } => {
1318
- return self . broadcast_by_local_state ( local_tx, & None , & None ) ;
1318
+ return ( self . broadcast_by_local_state ( local_tx, & None , & None ) , ( commitment_txid , tx . output . clone ( ) ) ) ;
1319
1319
}
1320
1320
}
1321
1321
}
1322
1322
}
1323
- ( Vec :: new ( ) , Vec :: new ( ) )
1323
+ ( ( Vec :: new ( ) , Vec :: new ( ) ) , ( commitment_txid , Vec :: new ( ) ) )
1324
1324
}
1325
1325
1326
1326
/// Used by ChannelManager deserialization to broadcast the latest local state if it's copy of
@@ -1359,9 +1359,12 @@ impl ChannelMonitor {
1359
1359
watch_outputs. push ( new_outputs) ;
1360
1360
}
1361
1361
if txn. is_empty ( ) {
1362
- let ( remote_txn, mut outputs) = self . check_spend_local_transaction ( tx, height) ;
1363
- spendable_outputs. append ( & mut outputs) ;
1364
- txn = remote_txn;
1362
+ let ( mut local_data, new_outputs) = self . check_spend_local_transaction ( tx, height) ;
1363
+ spendable_outputs. append ( & mut local_data. 1 ) ;
1364
+ txn = local_data. 0 ;
1365
+ if !new_outputs. 1 . is_empty ( ) {
1366
+ watch_outputs. push ( new_outputs) ;
1367
+ }
1365
1368
}
1366
1369
} else {
1367
1370
if let Some ( & ( commitment_number, _) ) = self . remote_commitment_txn_on_chain . get ( & prevout. txid ) {
0 commit comments