@@ -5160,32 +5160,32 @@ where
51605160 }
51615161
51625162 for htlc in context.pending_inbound_htlcs.iter() {
5163+ // We include LocalRemoved HTLCs here because we may still need to broadcast a commitment
5164+ // transaction including this HTLC if it times out before they RAA.
51635165 remote_htlc_total_msat += htlc.amount_msat;
51645166 if htlc.amount_msat / 1000 >= real_dust_limit_success_sat {
5165- // We include LocalRemoved HTLCs here because we may still need to broadcast a commitment
5166- // transaction including this HTLC if it times out before they RAA.
51675167 nondust_htlc_count += 1;
51685168 }
51695169 }
51705170
51715171 for htlc in context.pending_outbound_htlcs.iter() {
5172+ // We don't include AwaitingRemoteRevokeToRemove HTLCs because our next commitment
5173+ // transaction won't be generated until they send us their next RAA, which will mean
5174+ // dropping any HTLCs in this state.
51725175 if let OutboundHTLCState::LocalAnnounced { .. } | OutboundHTLCState::Committed | OutboundHTLCState::RemoteRemoved { .. } = htlc.state {
51735176 local_htlc_total_msat += htlc.amount_msat;
51745177 if htlc.amount_msat / 1000 >= real_dust_limit_timeout_sat {
5175- // We don't include AwaitingRemoteRevokeToRemove HTLCs because our next commitment
5176- // transaction won't be generated until they send us their next RAA, which will mean
5177- // dropping any HTLCs in this state.
51785178 nondust_htlc_count += 1;
51795179 }
51805180 }
51815181 }
51825182
51835183 for htlc in context.holding_cell_htlc_updates.iter() {
5184+ // Don't include claims/fails that are awaiting ack, because once we get the
5185+ // ack we're guaranteed to never include them in commitment txs anymore.
51845186 if let HTLCUpdateAwaitingACK::AddHTLC { amount_msat, .. } = htlc {
51855187 local_htlc_total_msat += amount_msat;
51865188 if amount_msat / 1000 >= real_dust_limit_timeout_sat {
5187- // Don't include claims/fails that are awaiting ack, because once we get the
5188- // ack we're guaranteed to never include them in commitment txs anymore.
51895189 nondust_htlc_count += 1;
51905190 }
51915191 }
@@ -5296,11 +5296,11 @@ where
52965296 }
52975297
52985298 for htlc in context.pending_outbound_htlcs.iter() {
5299+ // We only include outbound HTLCs if it will not be included in their next commitment_signed,
5300+ // i.e. if they've responded to us with an RAA after announcement.
52995301 if let OutboundHTLCState::Committed | OutboundHTLCState::RemoteRemoved {..} | OutboundHTLCState::LocalAnnounced { .. } = htlc.state {
53005302 local_htlc_total_msat += htlc.amount_msat;
53015303 if htlc.amount_msat / 1000 >= real_dust_limit_success_sat {
5302- // We only include outbound HTLCs if it will not be included in their next commitment_signed,
5303- // i.e. if they've responded to us with an RAA after announcement.
53045304 nondust_htlc_count += 1;
53055305 }
53065306 }
0 commit comments