Commit 47c1474
committed
Do not track HTLC IDs as separate MPP parts which need claiming
When we claim an MPP payment, we need to track which channels have
had the preimage durably added to their `ChannelMonitor` to ensure
we don't remove the preimage from any `ChannelMonitor`s until all
`ChannelMonitor`s have the preimage.
Previously, we tracked each MPP part, down to the HTLC ID, as a
part which we needed to get the preimage on disk for. However, this
is not necessary - once a `ChannelMonitor` has a preimage, it
applies it to all inbound HTLCs with the same payment hash.
Further, this can cause a channel to wait on itself in cases of
high-latency synchronous persistence -
* If we have receive an MPP payment for which multiple parts came
to us over the same channel,
* and claim the MPP payment, creating a `ChannelMonitorUpdate` for
the first part but enqueueing the remaining HTLC claim(s) in the
channel's holding cell,
* and we receive a `revoke_and_ack` for the same channel before
the `ChannelManager::claim_payment` method completes (as each
claim waits for the `ChannelMonitorUpdate` persistence),
* we will cause the `ChannelMonitorUpdate` for that
`revoke_and_ack` to go into the blocked set, waiting on the MPP
parts to be fully claimed,
* but when `claim_payment` goes to add the next
`ChannelMonitorUpdate` for the MPP claim, it will be placed in
the blocked set, since the blocked set is non-empty.
Thus, we'll end up with a `ChannelMonitorUpdate` in the blocked set
which is needed to unblock the channel since it is a part of the
MPP set which blocked the channel.1 parent 4826860 commit 47c1474
File tree
4 files changed
+211
-27
lines changed- lightning/src
- ln
- util
4 files changed
+211
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3860 | 3860 | | |
3861 | 3861 | | |
3862 | 3862 | | |
| 3863 | + | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
| 3882 | + | |
| 3883 | + | |
| 3884 | + | |
| 3885 | + | |
| 3886 | + | |
| 3887 | + | |
| 3888 | + | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
| 3911 | + | |
| 3912 | + | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
| 3932 | + | |
| 3933 | + | |
| 3934 | + | |
| 3935 | + | |
| 3936 | + | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
| 3945 | + | |
| 3946 | + | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
| 3961 | + | |
| 3962 | + | |
| 3963 | + | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
| 3974 | + | |
| 3975 | + | |
| 3976 | + | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
| 3984 | + | |
| 3985 | + | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
| 3999 | + | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1132 | 1132 | | |
1133 | 1133 | | |
1134 | 1134 | | |
1135 | | - | |
| 1135 | + | |
1136 | 1136 | | |
1137 | 1137 | | |
1138 | 1138 | | |
| |||
1234 | 1234 | | |
1235 | 1235 | | |
1236 | 1236 | | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
1237 | 1243 | | |
1238 | 1244 | | |
1239 | | - | |
1240 | | - | |
| 1245 | + | |
| 1246 | + | |
1241 | 1247 | | |
1242 | 1248 | | |
1243 | 1249 | | |
| |||
1252 | 1258 | | |
1253 | 1259 | | |
1254 | 1260 | | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
1261 | 1261 | | |
1262 | 1262 | | |
1263 | 1263 | | |
| |||
7207 | 7207 | | |
7208 | 7208 | | |
7209 | 7209 | | |
| 7210 | + | |
| 7211 | + | |
| 7212 | + | |
| 7213 | + | |
| 7214 | + | |
| 7215 | + | |
| 7216 | + | |
| 7217 | + | |
| 7218 | + | |
7210 | 7219 | | |
7211 | | - | |
| 7220 | + | |
7212 | 7221 | | |
7213 | 7222 | | |
7214 | 7223 | | |
| |||
7219 | 7228 | | |
7220 | 7229 | | |
7221 | 7230 | | |
7222 | | - | |
| 7231 | + | |
7223 | 7232 | | |
7224 | 7233 | | |
7225 | 7234 | | |
| |||
7552 | 7561 | | |
7553 | 7562 | | |
7554 | 7563 | | |
7555 | | - | |
| 7564 | + | |
7556 | 7565 | | |
7557 | 7566 | | |
7558 | 7567 | | |
| |||
7563 | 7572 | | |
7564 | 7573 | | |
7565 | 7574 | | |
7566 | | - | |
| 7575 | + | |
7567 | 7576 | | |
7568 | | - | |
7569 | | - | |
7570 | | - | |
| 7577 | + | |
7571 | 7578 | | |
7572 | | - | |
| 7579 | + | |
7573 | 7580 | | |
7574 | 7581 | | |
7575 | 7582 | | |
7576 | 7583 | | |
7577 | | - | |
7578 | | - | |
7579 | | - | |
7580 | | - | |
7581 | | - | |
7582 | | - | |
7583 | | - | |
| 7584 | + | |
| 7585 | + | |
7584 | 7586 | | |
7585 | 7587 | | |
7586 | 7588 | | |
| |||
14786 | 14788 | | |
14787 | 14789 | | |
14788 | 14790 | | |
| 14791 | + | |
| 14792 | + | |
| 14793 | + | |
| 14794 | + | |
| 14795 | + | |
14789 | 14796 | | |
14790 | | - | |
| 14797 | + | |
14791 | 14798 | | |
14792 | 14799 | | |
14793 | 14800 | | |
| |||
14820 | 14827 | | |
14821 | 14828 | | |
14822 | 14829 | | |
14823 | | - | |
| 14830 | + | |
14824 | 14831 | | |
14825 | 14832 | | |
14826 | 14833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
782 | 802 | | |
783 | 803 | | |
784 | 804 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| 401 | + | |
| 402 | + | |
401 | 403 | | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
405 | 407 | | |
406 | | - | |
| 408 | + | |
| 409 | + | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
| |||
420 | 423 | | |
421 | 424 | | |
422 | 425 | | |
| 426 | + | |
| 427 | + | |
423 | 428 | | |
424 | 429 | | |
425 | 430 | | |
| |||
433 | 438 | | |
434 | 439 | | |
435 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
436 | 446 | | |
437 | 447 | | |
438 | 448 | | |
| |||
455 | 465 | | |
456 | 466 | | |
457 | 467 | | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
458 | 473 | | |
459 | 474 | | |
460 | 475 | | |
| |||
0 commit comments