Commit 6a9dd2b
committed
Force-close channels if their feerate gets stale without any update
For quite some time, LDK has force-closed channels if the peer
sends us a feerate update which is below our `FeeEstimator`'s
concept of a channel lower-bound. This is intended to ensure that
channel feerates are always sufficient to get our commitment
transaction confirmed on-chain if we do need to force-close.
However, we've never checked our channel feerate regularly - if a
peer is offline (or just uninterested in updating the channel
feerate) and the prevailing feerates on-chain go up, we'll simply
ignore it and allow our commitment transaction to sit around with a
feerate too low to get confirmed.
Here we rectify this oversight by force-closing channels with stale
feerates, checking after each block. However, because fee
estimators are often buggy and force-closures piss off users, we
only do so rather conservatively. Specifically, we only force-close
if a channel's feerate is below the minimum `FeeEstimator`-provided
minimum across the last day.
Further, because fee estimators are often especially buggy on
startup (and because peers haven't had a chance to update the
channel feerates yet), we don't force-close channels until we have
a full day of feerate lower-bound history.
This should reduce the incidence of force-closures substantially,
but it is expected this will still increase force-closures somewhat
substantially depending on the users' `FeeEstimator`.
Fixes #9931 parent 1390f4b commit 6a9dd2b
2 files changed
+76
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5300 | 5300 | | |
5301 | 5301 | | |
5302 | 5302 | | |
| 5303 | + | |
| 5304 | + | |
| 5305 | + | |
| 5306 | + | |
| 5307 | + | |
| 5308 | + | |
| 5309 | + | |
| 5310 | + | |
| 5311 | + | |
| 5312 | + | |
| 5313 | + | |
| 5314 | + | |
| 5315 | + | |
| 5316 | + | |
| 5317 | + | |
| 5318 | + | |
| 5319 | + | |
| 5320 | + | |
| 5321 | + | |
| 5322 | + | |
5303 | 5323 | | |
5304 | 5324 | | |
5305 | 5325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
959 | 959 | | |
960 | 960 | | |
961 | 961 | | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
962 | 967 | | |
963 | 968 | | |
964 | 969 | | |
| |||
2093 | 2098 | | |
2094 | 2099 | | |
2095 | 2100 | | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2096 | 2116 | | |
2097 | 2117 | | |
2098 | 2118 | | |
| |||
3189 | 3209 | | |
3190 | 3210 | | |
3191 | 3211 | | |
| 3212 | + | |
| 3213 | + | |
3192 | 3214 | | |
3193 | 3215 | | |
3194 | 3216 | | |
| |||
9395 | 9417 | | |
9396 | 9418 | | |
9397 | 9419 | | |
9398 | | - | |
| 9420 | + | |
| 9421 | + | |
| 9422 | + | |
| 9423 | + | |
| 9424 | + | |
| 9425 | + | |
| 9426 | + | |
| 9427 | + | |
| 9428 | + | |
| 9429 | + | |
| 9430 | + | |
| 9431 | + | |
| 9432 | + | |
| 9433 | + | |
| 9434 | + | |
| 9435 | + | |
| 9436 | + | |
| 9437 | + | |
| 9438 | + | |
| 9439 | + | |
| 9440 | + | |
| 9441 | + | |
| 9442 | + | |
| 9443 | + | |
| 9444 | + | |
| 9445 | + | |
| 9446 | + | |
| 9447 | + | |
| 9448 | + | |
| 9449 | + | |
| 9450 | + | |
| 9451 | + | |
9399 | 9452 | | |
9400 | 9453 | | |
9401 | 9454 | | |
| |||
12350 | 12403 | | |
12351 | 12404 | | |
12352 | 12405 | | |
| 12406 | + | |
| 12407 | + | |
12353 | 12408 | | |
12354 | 12409 | | |
12355 | 12410 | | |
| |||
0 commit comments