`lightning-liquidity`: Consider ways to make event handling API more robust

Offen
#4,102 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
rust
Bereich
api, backend, blockchain

Rechercherichtung

Start from LiquidityManager::next_event and next_event_async and how they persist the event queue after #4059. Compare with lightning’s inline event-handler pattern, regeneration of critical events such as LSPS2ServiceEvent::OpenChannel on restart, and pending opens from #4101. Decide an approach that removes the crash-after-next_event race; done is a design plus API/docs that make those events idempotent or unmissable.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

lightning-liquidity

Currently, LiquidityManager::next_event/LiquidityManager::next_event_async return the next event an repersist the event queue (post #4059), which puts the responsibility to safely handle any important events on the user.

While some events are only informational and are not even persisted, some are critical to be able to continue the flow after a restart, for example LSPS2ServiceEvent::OpenChannel.

Currently, there might be a race if the user isn't super careful about how they implement their node logic: if the service happens to shutdown/crash just after calling next_event but before actually opening the channel, the service might lose the OpenChannel event.

We should eventually consider ways how we can make this less error prone, for example

a) Mirror the lightning event handling approach where we force the user to handle the event inline before returning the event handler function.
b) Regenerate any critical events on restart, while ensuring users have ways to make all of them idempotent
c) Have users detect what channel opens are pending based on #4101

Vorherrschende Sprache
Rust
Sterne
1.4k
Forks
482
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus lightningdevkit/rust-lightning

Alle Issues in lightningdevkit/rust-lightning

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.