@@ -1407,6 +1407,10 @@ impl ChannelMonitor {
14071407 output : spend_tx. output [ 0 ] . clone ( ) ,
14081408 } ) ;
14091409 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!
14101414 }
14111415 }
14121416 }
@@ -1578,6 +1582,9 @@ impl ChannelMonitor {
15781582 /// Should not be used if check_spend_revoked_transaction succeeds.
15791583 fn check_spend_local_transaction ( & self , tx : & Transaction , _height : u32 ) -> ( Vec < Transaction > , Vec < SpendableOutputDescriptor > , ( Sha256dHash , Vec < TxOut > ) ) {
15801584 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).
15811588 if let & Some ( ref local_tx) = & self . current_local_signed_commitment_tx {
15821589 if local_tx. txid == commitment_txid {
15831590 match self . key_storage {
@@ -1746,6 +1753,16 @@ impl ChannelMonitor {
17461753 }
17471754
17481755 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.
17491766 if let Some ( ref cur_local_tx) = self . current_local_signed_commitment_tx {
17501767 for & ( ref htlc, _, _) in cur_local_tx. htlc_outputs . iter ( ) {
17511768 // For inbound HTLCs which we know the preimage for, we have to ensure we hit the
0 commit comments