Issue #966 tracks a recurring class of crash/replay gaps between LDK-managed state and ldk-node-managed state. LDK persists ChannelManager, ChannelMonitors, and replayable LDK events. ldk-node separately persists PaymentDetails in PaymentStore and user-facing events in EventQueue.
When those streams are written independently, one side of a logical transition can become durable while the other does not. That leads to missing payment records, replay-only reconstruction, duplicate app events, startup backfill questions, and case-by-case reconciliation logic.
I think we should consider adding an atomic batch-write primitive to the ldk-node KV store layer, so related records can be committed as one restart-consistent unit. For example, one batch could include the LDK-derived persistence update, the corresponding PaymentStore update, and the EventQueue update that exposes it to the application.
The goal is not to require SQL, one big serialized blob, or a full LDK persistence redesign. The narrower goal is to let ldk-node write semantically coupled records together when needed, and have either all of them become durable or none of them become durable.
This seems like a natural extension of deferred writing. We already hold work until a persistence boundary; the missing piece is that ldk-node records still land through separate streams. If the underlying store supports atomic batches, the same boundary could include ldk-node state too.
Issue #966 tracks a recurring class of crash/replay gaps between LDK-managed state and ldk-node-managed state. LDK persists
ChannelManager,ChannelMonitors, and replayable LDK events. ldk-node separately persistsPaymentDetailsinPaymentStoreand user-facing events inEventQueue.When those streams are written independently, one side of a logical transition can become durable while the other does not. That leads to missing payment records, replay-only reconstruction, duplicate app events, startup backfill questions, and case-by-case reconciliation logic.
I think we should consider adding an atomic batch-write primitive to the ldk-node KV store layer, so related records can be committed as one restart-consistent unit. For example, one batch could include the LDK-derived persistence update, the corresponding
PaymentStoreupdate, and theEventQueueupdate that exposes it to the application.The goal is not to require SQL, one big serialized blob, or a full LDK persistence redesign. The narrower goal is to let ldk-node write semantically coupled records together when needed, and have either all of them become durable or none of them become durable.
This seems like a natural extension of deferred writing. We already hold work until a persistence boundary; the missing piece is that ldk-node records still land through separate streams. If the underlying store supports atomic batches, the same boundary could include ldk-node state too.