Skip to content

fix: count a maybe-broadcast pool tx as unconfirmed in --all sweeps - #2430

Merged
thiras merged 2 commits into
mainfrom
fix/pool-batch-unconfirmed
Oct 12, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/pool-batch-unconfirmed

Conversation

@thiras

@thiras thiras commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

decdn pool close --all and pool reclaim --all counted every per-pool error as failed. That included a send that may have broadcast (#2416) and a broadcast tx whose receipt could not be read. The summary line, the final error and the exit code all reported a definite failure, so an operator or wrapper reading only the last line could re-run and double-submit.

  • New CLI-private context marker TxUnconfirmed { label, tx: Option<TxHash> }, modelled on OpenUnconfirmed / TopUpUnconfirmed. send_failed attaches it when send_broadcast_unknown holds. close_and_forget / reclaim_and_forget attach it when the receipt read fails.
  • BatchTally gains unconfirmed (disjoint from failed) and record_error, which classifies by downcast_ref instead of matching text. For these cases the per-pool line reads "close of pool X unconfirmed: …".
  • The summary prints …, failed F, unconfirmed U. batch_result names both counts, e.g. "2 pool(s) failed to close, and 1 pool(s) may have broadcast a close transaction — check this signer's pending and mined transactions before re-running; see the summary above".

Closes #2427

Reviewer notes

Verification

  • cargo fmt -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo nextest run -p decdn-cli pool::: 54 passed. New tests: close_all_… and reclaim_all_counts_a_transport_failed_send_as_unconfirmed (mocked provider, two rejected sends and one transport-failed send → 2 failed, 1 unconfirmed), record_error_splits_unconfirmed_from_failed, and batch_result_names_unconfirmed_pools_apart_from_failed_ones. Mutation-checked: an inverted classifier fails all three tally tests. The existing transport / rejected / unreadable-receipt tests for closePool and reclaim now assert the marker too.
  • CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items
  • contracts/ changed: n/a
  • User-visible change: CHANGELOG.md entry added
  • Design change: n/a
  • PR title uses an allowed type with a lowercase subject

🤖 Generated with Claude Code

`pool close --all` and `pool reclaim --all` counted every per-pool error
as failed, so the summary, the final error and the exit code reported a
definite failure for a tx that may still mine.

A `closePool`/`reclaim` send that fails in transport, or a broadcast tx
whose receipt cannot be read, now carries a typed `TxUnconfirmed`
context (its Display keeps the existing messages). `BatchTally` counts
those apart from failures, the summary prints an `unconfirmed` count,
and `batch_result` names it with a check-before-re-running note. The
exit code stays nonzero. A JSON-RPC rejection still counts as failed.

Closes #2427

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 10:34
@thiras thiras self-assigned this Oct 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The typed classification, reporting paths, and focused tests consistently implement the stated behavior.

0 open findings

What changed in this PR

Separates uncertain pool transactions from definite failures during batch close/reclaim operations.

Changes:

  • Adds typed TxUnconfirmed error classification and batch tallying.
  • Updates operator messages and tests for uncertain broadcasts.
  • Documents the behavior change.
File Description
crates/​cli/​src/​commands/​pool.rs Classifies and reports unconfirmed transactions.
crates/​cli/​src/​commands/​pool/​tests.rs Tests error markers and batch summaries.
CHANGELOG.md Records the user-visible behavior change.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The close --all test had one rejected and one transport-failed pool, so
a swapped classifier still produced 1 failed / 1 unconfirmed. Queue two
rejections and one transport failure instead, add the same test for
reclaim --all (with a mocked head block), and test `record_error`
directly. Tighten the `send_failed` doc now that its note lives in
`TxUnconfirmed`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 06dd1ec in the fix/pool-batch-uncon... branch remains at 75%, unchanged from commit 8613695 in the main branch.

Show a line coverage summary of the most impacted files.
File main 8613695 fix/pool-batch-uncon... 06dd1ec +/-
crates/client/src/lib.rs 88% 88% 0%
crates/cli/src/...ds/chain_ctx.rs 76% 77% +1%
crates/node/src/dht/publish.rs 78% 80% +2%
crates/cli/src/...ommands/pool.rs 58% 64% +6%

@thiras
thiras merged commit 0cfa3f2 into main Oct 12, 2026
31 checks passed
@thiras
thiras deleted the fix/pool-batch-unconfirmed branch October 12, 2026 10:51
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.

fix: pool batch summary counts a maybe-broadcast tx as failed

2 participants