Skip to content

fix(net): clean up disconnected peer state - #7584

Open
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:t3code/clarify-disconnected-ban-state
Open

fix(net): clean up disconnected peer state#7584
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:t3code/clarify-disconnected-ban-state

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

PeerManagerImpl::IsBanned(NodeId) did not report a persistent BanMan ban. It only checked whether the live peer object had crossed the discouragement threshold, and returned false after FinalizeNode removed that object. The misleading name obscured the lifecycle behavior and caused LLMQ cleanup predicates to retain queued state when they ran after peer finalization.

What was done?

  • Replace the ambiguous IsBanned / PeerIsBanned interface with PeerIsDisconnectedOrDiscouraged.
  • Treat a missing peer object as disconnected, allowing LLMQ recovered-signature and signature-share cleanup to remove state after finalization.
  • Rename the LLMQ cleanup helper to describe the state it actually removes.
  • Add unit-test assertions for connected, discouraged, and finalized peer states.

How Has This Been Tested?

Tested on macOS arm64 using the depends toolchain:

  • make -j13
  • ./src/test/test_dash --run_test=denialofservice_tests
  • test/lint/all-lint.py
  • git diff --check

The full lint suite passed; its Python lint step reported that flake8 was not installed.

Breaking Changes

None. The renamed interface is internal to the networking and LLMQ implementation.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

This pull request was created by Codex.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d7e91f26-fd70-4f94-bd13-e3f35c0ef4e2

📥 Commits

Reviewing files that changed from the base of the PR and between c30e901 and 315f683.

📒 Files selected for processing (5)
  • src/llmq/net_signing.cpp
  • src/llmq/net_signing.h
  • src/net_processing.cpp
  • src/net_processing.h
  • src/test/denialofservice_tests.cpp

Walkthrough

The peer manager now reports whether a peer is disconnected or discouraged. Missing peers return true, and discouraged peers are checked under the peer mutex. NetSigning uses this status to remove pending recovered signatures and share state. The cleanup method and its worker call were renamed. Denial-of-service tests verify status before and after discouragement and during node finalization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 315f6

This localized state-cleanup change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Possibly related PRs

  • dashpay/dash#7563: Modifies NetSigning pending recovered-signature cleanup and peer-state handling.

Suggested reviewers: knst

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: cleaning up state for disconnected peers.
Description check ✅ Passed The description directly explains the interface changes, cleanup behavior, testing, and expected impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Aug 12, 2026

Copy link
Copy Markdown

🔍 Review in progress — actively reviewing now (commit 315f683)
Stage: Codex precheck starting
ETA: complete ~16:52 UTC (median 17m across 30 recent reviews)
Running 4m · Last checked: 2026-08-12 16:40 UTC

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@coderabbitai review\n\n---\n🤖 Posted autonomously by Codex on behalf of pasta.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

@PastaPastaPasta I will review pull request #7584.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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