@@ -1407,6 +1407,10 @@ impl ChannelMonitor {
1407
1407
output : spend_tx. output [ 0 ] . clone ( ) ,
1408
1408
} ) ;
1409
1409
txn_to_broadcast. push ( spend_tx) ;
1410
+
1411
+ // TODO: We need to fail back HTLCs that were't included in the broadcast
1412
+ // commitment transaction, either because they didn't meet dust or because a
1413
+ // stale (but not yet revoked) commitment transaction was broadcast!
1410
1414
}
1411
1415
}
1412
1416
}
@@ -1578,6 +1582,9 @@ impl ChannelMonitor {
1578
1582
/// Should not be used if check_spend_revoked_transaction succeeds.
1579
1583
fn check_spend_local_transaction ( & self , tx : & Transaction , _height : u32 ) -> ( Vec < Transaction > , Vec < SpendableOutputDescriptor > , ( Sha256dHash , Vec < TxOut > ) ) {
1580
1584
let commitment_txid = tx. txid ( ) ;
1585
+ // TODO: If we find a match here we need to fail back HTLCs that were't included in the
1586
+ // broadcast commitment transaction, either because they didn't meet dust or because they
1587
+ // weren't yet included in our commitment transaction(s).
1581
1588
if let & Some ( ref local_tx) = & self . current_local_signed_commitment_tx {
1582
1589
if local_tx. txid == commitment_txid {
1583
1590
match self . key_storage {
@@ -1746,6 +1753,16 @@ impl ChannelMonitor {
1746
1753
}
1747
1754
1748
1755
pub ( super ) fn would_broadcast_at_height ( & self , height : u32 ) -> bool {
1756
+ // TODO: We need to consider HTLCs which weren't included in latest local commitment
1757
+ // transaction (or in any of the latest two local commitment transactions). This probably
1758
+ // needs to use the same logic as the revoked-tx-announe logic - checking the last two
1759
+ // remote commitment transactions. This probably has implications for what data we need to
1760
+ // store in local commitment transactions.
1761
+ // TODO: We need to consider HTLCs which were below dust threshold here - while they don't
1762
+ // strictly imply that we need to fail the channel, we need to go ahead and fail them back
1763
+ // to the source, and if we don't fail the channel we will have to ensure that the next
1764
+ // updates that peer sends us are update_fails, failing the channel if not. It's probably
1765
+ // easier to just fail the channel as this case should be rare enough anyway.
1749
1766
if let Some ( ref cur_local_tx) = self . current_local_signed_commitment_tx {
1750
1767
for & ( ref htlc, _, _) in cur_local_tx. htlc_outputs . iter ( ) {
1751
1768
// For inbound HTLCs which we know the preimage for, we have to ensure we hit the
0 commit comments