Commit d36fdab
committed
Improve prediction of commitment stats in
`ChannelContext::get_pending_htlc_stats` predicts that the set of HTLCs
on the next commitment will be all the HTLCs in
`ChannelContext.pending_inbound_htlcs`, and
`ChannelContext.pending_outbound_htlcs`, as well as all the outbound
HTLC adds in the holding cell.
This is an overestimate:
* Outbound HTLC removals which have been ACK'ed by the counterparty will
certainly not be present in any *next* commitment, even though they
remain in `pending_outbound_htlcs`.
* Outbound HTLCs in the `RemoteRemoved` state, will not be present in
the next *local* commitment.
* Outbound HTLCs in the `LocalAnnounced` state have no guarantee that
they were received by the counterparty before she sent the
`update_fee`.
* Outbound `update_add_htlc`'s in the holding cell are certainly not
known by the counterparty, and we will reevaluate their addition to
the channel when freeing the holding cell.
* Inbound HTLCs in the `LocalRemoved` state will not be present in the
next *remote* commitment.
This commit stops using `get_pending_htlc_stats` in favor of the newly
added `ChannelContext::get_next_{local, remote}_commitment_stats`
methods, and fixes the issues described above.
We now always calculate dust exposure using a buffer from
`msg.feerate_per_kw`, and not from
`max(self.feerate_per_kw, msg.feerate_per_kw)`.validate_update_fee
1 parent 3218db1 commit d36fdab
1 file changed
+10
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4338 | 4338 | | |
4339 | 4339 | | |
4340 | 4340 | | |
4341 | | - | |
| 4341 | + | |
| 4342 | + | |
| 4343 | + | |
| 4344 | + | |
| 4345 | + | |
4342 | 4346 | | |
4343 | | - | |
| 4347 | + | |
4344 | 4348 | | |
4345 | | - | |
| 4349 | + | |
4346 | 4350 | | |
4347 | | - | |
| 4351 | + | |
4348 | 4352 | | |
4349 | | - | |
| 4353 | + | |
4350 | 4354 | | |
| 4355 | + | |
4351 | 4356 | | |
4352 | 4357 | | |
4353 | 4358 | | |
| |||
0 commit comments