Commit 1eb0965
committed
Track pending channel opens to prevent duplicates
After the previous commit moved usability checks to execute time,
the timer can call process_htlcs_for_peer repeatedly while a
channel is still opening. calculate_htlc_actions_for_peer sees no
is_channel_ready channels and requests a new one each time,
producing duplicate OpenChannel events.
Add a pending_channel_opens set (RwLock<HashSet<PublicKey>>).
execute_htlc_actions inserts the peer when it emits OpenChannel,
and channel_ready removes it. If the set already contains the
peer, the OpenChannel is suppressed.
calculate_htlc_actions_for_peer now filters by is_channel_ready
instead of including all channels. Channels still opening
(is_channel_ready=false) report outbound_capacity_msat but reject
forwards with "Channel is still opening", consuming the
InterceptId and losing the HTLC. These are zero-conf channels, so
on-chain confirmation is not the issue; the channel simply hasn't
finished its opening handshake yet. Reestablishing channels
(is_channel_ready=true, is_usable=false) can forward once
reestablish completes and are included, preserving the
spurious-open fix from the previous commit.1 parent 331d1bd commit 1eb0965
1 file changed
Lines changed: 23 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| 262 | + | |
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
| |||
581 | 584 | | |
582 | 585 | | |
583 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
584 | 593 | | |
585 | 594 | | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
586 | 598 | | |
587 | 599 | | |
588 | 600 | | |
| |||
773 | 785 | | |
774 | 786 | | |
775 | 787 | | |
776 | | - | |
| 788 | + | |
777 | 789 | | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
778 | 798 | | |
779 | 799 | | |
780 | 800 | | |
781 | 801 | | |
782 | 802 | | |
783 | 803 | | |
784 | | - | |
| 804 | + | |
785 | 805 | | |
786 | 806 | | |
787 | 807 | | |
788 | 808 | | |
789 | 809 | | |
790 | 810 | | |
| 811 | + | |
791 | 812 | | |
792 | 813 | | |
793 | 814 | | |
| |||
0 commit comments