Commit 4d316b2
committed
Avoid redundant closed channel preimage updates
Previously, if when we restart with the ChannelManager behind a ChannelMonitor,
and that monitor has already claimed an HTLC but the manager thinks the HTLC is
yet-to-be-claimed, we will generate a redundant preimage monitor update.
That was fine since the manager being behind the monitor is rare, but in
upcoming commits we are moving towards not persisting the ChannelManager's
pending_claiming_payments map, and instead rebuilding its contents from the
monitors.
As a consequence of these changes, our existing safeguard that prevents
generating redundant preimage monitor updates in the case that the manager is
*not* behind the monitor will no longer work, because we can no longer check
the pending_claiming_payments map to short circuit the logic that generates the
(possibly redundant) preimage monitor updates.
So here we implement more rigorous checks to see whether a preimage update for
a closed channel is redundant or not before generating it, which prevents the
current manager-behind cases as well as upcoming cases when we start
reconstructing the pending_claiming_payments map.1 parent 2503327 commit 4d316b2
3 files changed
Lines changed: 78 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9506 | 9506 | | |
9507 | 9507 | | |
9508 | 9508 | | |
| 9509 | + | |
| 9510 | + | |
| 9511 | + | |
| 9512 | + | |
| 9513 | + | |
| 9514 | + | |
| 9515 | + | |
| 9516 | + | |
| 9517 | + | |
| 9518 | + | |
| 9519 | + | |
| 9520 | + | |
| 9521 | + | |
| 9522 | + | |
| 9523 | + | |
| 9524 | + | |
| 9525 | + | |
| 9526 | + | |
9509 | 9527 | | |
| 9528 | + | |
| 9529 | + | |
| 9530 | + | |
| 9531 | + | |
| 9532 | + | |
| 9533 | + | |
| 9534 | + | |
| 9535 | + | |
| 9536 | + | |
| 9537 | + | |
| 9538 | + | |
| 9539 | + | |
| 9540 | + | |
| 9541 | + | |
| 9542 | + | |
| 9543 | + | |
| 9544 | + | |
| 9545 | + | |
9510 | 9546 | | |
9511 | 9547 | | |
9512 | 9548 | | |
| |||
9530 | 9566 | | |
9531 | 9567 | | |
9532 | 9568 | | |
9533 | | - | |
9534 | | - | |
9535 | | - | |
9536 | | - | |
9537 | | - | |
9538 | | - | |
9539 | | - | |
9540 | | - | |
9541 | | - | |
9542 | | - | |
9543 | | - | |
9544 | | - | |
9545 | | - | |
9546 | | - | |
9547 | | - | |
9548 | 9569 | | |
9549 | 9570 | | |
9550 | 9571 | | |
| |||
19820 | 19841 | | |
19821 | 19842 | | |
19822 | 19843 | | |
| 19844 | + | |
| 19845 | + | |
| 19846 | + | |
| 19847 | + | |
| 19848 | + | |
| 19849 | + | |
| 19850 | + | |
| 19851 | + | |
| 19852 | + | |
19823 | 19853 | | |
19824 | 19854 | | |
19825 | 19855 | | |
| |||
19890 | 19920 | | |
19891 | 19921 | | |
19892 | 19922 | | |
19893 | | - | |
19894 | | - | |
19895 | | - | |
19896 | | - | |
19897 | | - | |
| 19923 | + | |
| 19924 | + | |
| 19925 | + | |
| 19926 | + | |
| 19927 | + | |
| 19928 | + | |
| 19929 | + | |
| 19930 | + | |
| 19931 | + | |
| 19932 | + | |
| 19933 | + | |
| 19934 | + | |
| 19935 | + | |
| 19936 | + | |
19898 | 19937 | | |
19899 | 19938 | | |
19900 | 19939 | | |
19901 | 19940 | | |
19902 | 19941 | | |
19903 | | - | |
19904 | | - | |
19905 | | - | |
19906 | | - | |
| 19942 | + | |
| 19943 | + | |
19907 | 19944 | | |
19908 | 19945 | | |
19909 | 19946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3397 | 3397 | | |
3398 | 3398 | | |
3399 | 3399 | | |
3400 | | - | |
3401 | | - | |
3402 | | - | |
3403 | | - | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
3404 | 3403 | | |
3405 | 3404 | | |
3406 | 3405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
856 | | - | |
857 | | - | |
858 | | - | |
| 856 | + | |
| 857 | + | |
859 | 858 | | |
860 | 859 | | |
861 | | - | |
862 | | - | |
863 | | - | |
| 860 | + | |
| 861 | + | |
864 | 862 | | |
865 | 863 | | |
866 | 864 | | |
| |||
929 | 927 | | |
930 | 928 | | |
931 | 929 | | |
932 | | - | |
| 930 | + | |
933 | 931 | | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
934 | 935 | | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
935 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
936 | 943 | | |
937 | 944 | | |
938 | 945 | | |
| |||
0 commit comments