Commit 77bea65
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 66e6ee5 commit 77bea65
File tree
3 files changed
+98
-1
lines changed- fuzz/src
- lightning/src/ln
3 files changed
+98
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
917 | 917 | | |
918 | 918 | | |
919 | 919 | | |
| 920 | + | |
| 921 | + | |
920 | 922 | | |
921 | 923 | | |
922 | 924 | | |
923 | 925 | | |
| 926 | + | |
924 | 927 | | |
925 | 928 | | |
| 929 | + | |
926 | 930 | | |
| 931 | + | |
927 | 932 | | |
| 933 | + | |
928 | 934 | | |
| 935 | + | |
929 | 936 | | |
| 937 | + | |
930 | 938 | | |
| 939 | + | |
931 | 940 | | |
| 941 | + | |
932 | 942 | | |
| 943 | + | |
933 | 944 | | |
| 945 | + | |
934 | 946 | | |
| 947 | + | |
935 | 948 | | |
| 949 | + | |
936 | 950 | | |
| 951 | + | |
937 | 952 | | |
938 | 953 | | |
939 | 954 | | |
| |||
1303 | 1318 | | |
1304 | 1319 | | |
1305 | 1320 | | |
| 1321 | + | |
1306 | 1322 | | |
1307 | 1323 | | |
1308 | 1324 | | |
1309 | 1325 | | |
1310 | 1326 | | |
| 1327 | + | |
1311 | 1328 | | |
1312 | 1329 | | |
| 1330 | + | |
1313 | 1331 | | |
1314 | 1332 | | |
| 1333 | + | |
1315 | 1334 | | |
1316 | 1335 | | |
| 1336 | + | |
1317 | 1337 | | |
1318 | 1338 | | |
| 1339 | + | |
1319 | 1340 | | |
1320 | 1341 | | |
| 1342 | + | |
1321 | 1343 | | |
1322 | 1344 | | |
1323 | 1345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5117 | 5117 | | |
5118 | 5118 | | |
5119 | 5119 | | |
| 5120 | + | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
5120 | 5140 | | |
5121 | 5141 | | |
5122 | 5142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
965 | 970 | | |
966 | 971 | | |
967 | 972 | | |
| |||
2098 | 2103 | | |
2099 | 2104 | | |
2100 | 2105 | | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
2101 | 2121 | | |
2102 | 2122 | | |
2103 | 2123 | | |
| |||
2875 | 2895 | | |
2876 | 2896 | | |
2877 | 2897 | | |
| 2898 | + | |
| 2899 | + | |
2878 | 2900 | | |
2879 | 2901 | | |
2880 | 2902 | | |
| |||
9173 | 9195 | | |
9174 | 9196 | | |
9175 | 9197 | | |
9176 | | - | |
| 9198 | + | |
| 9199 | + | |
| 9200 | + | |
| 9201 | + | |
| 9202 | + | |
| 9203 | + | |
| 9204 | + | |
| 9205 | + | |
| 9206 | + | |
| 9207 | + | |
| 9208 | + | |
| 9209 | + | |
| 9210 | + | |
| 9211 | + | |
| 9212 | + | |
| 9213 | + | |
| 9214 | + | |
| 9215 | + | |
| 9216 | + | |
| 9217 | + | |
| 9218 | + | |
| 9219 | + | |
| 9220 | + | |
| 9221 | + | |
| 9222 | + | |
| 9223 | + | |
| 9224 | + | |
| 9225 | + | |
| 9226 | + | |
| 9227 | + | |
| 9228 | + | |
| 9229 | + | |
9177 | 9230 | | |
9178 | 9231 | | |
9179 | 9232 | | |
| |||
11992 | 12045 | | |
11993 | 12046 | | |
11994 | 12047 | | |
| 12048 | + | |
| 12049 | + | |
11995 | 12050 | | |
11996 | 12051 | | |
11997 | 12052 | | |
| |||
0 commit comments