Skip to content

fix: pool close/reclaim leave the local row on a pool that is no longer Open #2425

Closed

Description

@thiras

Problem

After a closePool or reclaim mines, no CLI command clears the local buyer row if the first run did not. A later fetch can then reuse a pool that is closing or closed.

Case What happens
reclaim mined, but forget_if_pool failed forget_after_reclaim (crates/cli/src/commands/pool.rs) tells the operator to re-run decdn pool reclaim --pool X to clear the row. The re-run reads the pool as Closed. single_reclaim_gate bails at SkipClosed before the store is touched. reclaim --all prints "already reclaimed" and skips the store too.
reclaim send failed in transport or the receipt was unreadable, but the tx mined Same dead end: the row survives, and every re-run stops at SkipClosed.
closePool send failed in transport or the receipt was unreadable, but the tx mined forget_after_close runs only on a read receipt. A re-run of close --pool X bails "is not Open — nothing to close". close --all skips the pool as already closing. The row clears only on a later successful reclaim, or when fetch's funding recovery hits PoolNotOpen.

The comment on forget_after_reclaim names the result: a closed pool whose deposit still reads healthy, so fetch signs vouchers that redeemMany rejects. #2416 makes the second and third rows more visible but does not cause them.

Fix

Clear the local row wherever the CLI sees on-chain that a pool is no longer Open:

  • reclaim --pool, SkipClosed: clear the row, then report.
  • reclaim --all, SkipClosed: the same.
  • close --pool refusal and close --all skip on Closing: clear the row.

Use LocalBookkeeping so a daemon-owned store keeps its current "row untouched" report.

Checks

  • A test per site: a pool that reads Closed (reclaim) or Closing (close) clears the owner's row for that pool, and a row for another pool stays.
  • The forget_after_reclaim warning names a command that clears the row.

Activity

  1. added
    kind:bug
    area:cli
    on Oct 12, 2026
  2. self-assigned this
    on Oct 12, 2026
  3. added
    area:payments
    on Oct 12, 2026
  4. removed their assignment
    on Oct 12, 2026
  5. thiras commented on Oct 12, 2026

    @thiras
    ContributorAuthor

    A related case, found in the review of #2430. It is in the same code, so it may fit this fix.

    close --all: a landed close whose row-clear fails is counted as "failed to close".

    close_and_forget (crates/cli/src/commands/pool.rs) runs store.forget_after_close(...)? after the closePool receipt shows Landed. If forget_if_pool returns Err, grade_local_forget turns it into an error. close_all then passes that error to BatchTally::record_error. The error carries no TxUnconfirmed, so it counts as failed:

    • Per-pool line: "failed to close pool X: pool X closed on-chain (tx …) but clearing it from the local store failed …". The line contradicts itself.
    • Summary: failed 1. Final error: "1 pool(s) failed to close".

    The close did land. A re-run of close --all skips the pool as already closing, so with today's code the row survives. The Closing-skip row-clear in this issue's fix repairs the row on that re-run. The tally is still wrong on the first run.

    Suggested addition: count a landed close with a faulted row-clear as acted, and print the row-clear fault as a warning, the way forget_after_reclaim does. The headline then does not say "failed to close" for a close that landed. Check: a close_all test with a store whose forget_if_pool fails → acted 1, failed 0, and the warning names the tx.

  6. self-assigned this
    on Oct 13, 2026
  7. moved this from Backlog to In progress in deCDNon Oct 13, 2026
  8. moved this from In progress to Done in deCDNon Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cliarea:paymentskind:bug

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions