fix: bound pending recovery and reclaim rejected settlement state #26
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/pending-resources"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Distinct unverified Cashu submissions could grow durable pending work without limit, and pre-melt rejection removed only the pending marker while leaving settlement ownership and source-wallet storage behind.
Enforce atomic limits of 1,024 pending submissions globally and eight per intent, preserving existing retries at capacity. Persist a round-robin recovery cursor and bound each Cashu recovery pass to eight attempts and 30 seconds. Durably checkpoint cleanup before deleting rejected source-wallet seeds/databases and atomically removing settlement and unused hold records. Add an idempotent discard hook for caller-owned source wallets.
Retain started melts and change-recovery state. Uncollected Cashu destination quotes keep a bounded cleanup reservation because their invoices may receive late payments; recovery collects those funds without granting a receipt. Cap uncollected receiving-wallet quotes, including orphaned responses, at 1,024.
Depends on #25. Addresses the two Medium resource-exhaustion findings supplied in review; these findings have no separate repository issue.
Validation: admission races and restart, original-token retries at capacity, cleanup interruption, managed/provider file removal, manual hold reuse, orphaned quote capacity, and late-fund collection regressions passed. All 78 tests, formatting, Clippy, docs, cargo-deny, native Nix checks, and real Bitcoin/LDK regtest passed. Custom PaymentStore implementations must add the recovery/cleanup operations, and source providers must implement discard().