Skip to content

Add APIs to prune completed state for LSPS1/LSPS2/LSPS5#4526

Draft
f3r10 wants to merge 1 commit intolightningdevkit:mainfrom
f3r10:feat/add_apis_to_prune_completed_state
Draft

Add APIs to prune completed state for LSPS1/LSPS2/LSPS5#4526
f3r10 wants to merge 1 commit intolightningdevkit:mainfrom
f3r10:feat/add_apis_to_prune_completed_state

Conversation

@f3r10
Copy link
Copy Markdown

@f3r10 f3r10 commented Mar 31, 2026

No description provided.

`LSPS1ServiceHandler` accumulates `ChannelOrder` records indefinitely.
`CompletedAndChannelOpened` orders were never pruned automatically, and
`FailedAndRefunded` orders were only pruned once all payment invoices in
them had expired — which can be days away.

Add `LSPS1ServiceHandler::prune_order` (and a sync wrapper on
`LSPS1ServiceHandlerSync`) that lets the LSP operator explicitly remove
any order that has reached a terminal state. The call persists the
change to the KVStore before returning.

Non-terminal orders (`ExpectingPayment`, `OrderPaid`) are rejected with
the new `PeerStateError::OrderNotPrunable` variant so that in-progress
orders cannot be silently discarded.
@ldk-reviews-bot
Copy link
Copy Markdown

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants