Commit 49798a0
authored
Fix liquidity event cancellation in select loop (#21)
handle_next_event() both consumed events from the queue via
next_event_async() and processed them inline, including
spawn_blocking(...).await calls for wallet checks. Because
this ran as a polled future inside tokio::select!, any tick
timer firing while the handler was suspended at an .await
point would cancel the future. The event had already been
dequeued, so it was silently lost.
Split event receipt from processing: next_event_async() is
polled as the select! future (cancellation-safe since it only
dequeues on Poll::Ready), and handle_event() runs in the
handler block which select! guarantees runs to completion
before the next iteration.
This was the root cause of JIT channel opens and splices
timing out in production. The HTLC would be intercepted,
the OpenChannel event consumed from the queue, but a timer
tick would cancel processing before create_channel was called.
The peer would disconnect after 40s and the HTLC would expire.1 parent ac65798 commit 49798a0
2 files changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
651 | 651 | | |
652 | 652 | | |
653 | 653 | | |
| 654 | + | |
654 | 655 | | |
655 | 656 | | |
656 | 657 | | |
| |||
666 | 667 | | |
667 | 668 | | |
668 | 669 | | |
669 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
670 | 673 | | |
671 | 674 | | |
672 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
523 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
524 | 528 | | |
525 | 529 | | |
526 | 530 | | |
| |||
0 commit comments