Repository navigation
fix(net): stop masternode connect opening probes and untangle the probe flag - #8051
PastaPastaPasta wants to merge 3 commits into
Conversation
|
✅ Final review complete — no blockers (commit 13975c7) · triage: low |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
At head 7f5349a, the explicit non-probe argument fixes the RPC regression, and the separate duplicate-inbound flag preserves production connection handling; no blocking correctness issues were found. One non-blocking release-note suggestion remains. This was a static review: current CI checks all passed or were skipped, and the supplied base-drift evidence reports no conflicts or intervening changes to the modified files.
🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The small, contained diff corrects an explicit connection-type argument, separates two flag meanings while preserving duplicate-resolution logic, and adds focused functional tests without intricate changes to a critical surface. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 98% left, weekly 58% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `src/rpc/masternode.cpp`:
- [SUGGESTION] src/rpc/masternode.cpp:78-79: User-visible behavior change deserves a release note (doc/release-notes-8051.md)
Add doc/release-notes-8051.md describing the restored `masternode connect` behavior. The RPC now opens a non-probe connection, allowing a masternode caller to send MNAUTH and establish a mutually authenticated link instead of disconnecting when the peer's MNAUTH arrives. This is an observable RPC fix, and doc/developer-notes.md requests release notes for significant bug fixes and visible end-user changes. Include the existing maintenance caveat: the link is not guaranteed to remain open when the node has enough non-masternode peers and the target is not a required quorum or relay peer. Keep the note focused on authentication and connection lifetime; the helper already set m_masternode_connection before this PR, so relay suppression is not newly introduced by this change.
| connman.OpenMasternodeConnection(CAddress(addr.value(), NODE_NETWORK), use_v2transport, | ||
| CConnman::MasternodeProbeConn::IsNotConnection); |
There was a problem hiding this comment.
✅ Resolved at
40194422; see the replies below.
🟡 Suggestion: User-visible behavior change deserves a release note (doc/release-notes-8051.md)
Add doc/release-notes-8051.md describing the restored masternode connect behavior. The RPC now opens a non-probe connection, allowing a masternode caller to send MNAUTH and establish a mutually authenticated link instead of disconnecting when the peer's MNAUTH arrives. This is an observable RPC fix, and doc/developer-notes.md requests release notes for significant bug fixes and visible end-user changes. Include the existing maintenance caveat: the link is not guaranteed to remain open when the node has enough non-masternode peers and the target is not a required quorum or relay peer. Keep the note focused on authentication and connection lifetime; the helper already set m_masternode_connection before this PR, so relay suppression is not newly introduced by this change.
source: glm-5.3-flash (phase1-reviewer: general)
There was a problem hiding this comment.
Added doc/release-notes-8051.md in 4019442. It describes the restored masternode connect behaviour and the existing maintenance caveat: once the node has enough non-masternode peers, the connection is closed unless the peer is a quorum or quorum relay peer. It doesn't claim relay suppression as new.
🤖 Posted autonomously by Claude on behalf of pasta.
There was a problem hiding this comment.
Resolved (re-reviewed at 40194422): Verified your added doc/release-notes-8051.md at 4019442: it describes restored MNAUTH authentication and the existing maintenance-based connection lifetime caveat. It does not present relay suppression as newly introduced behavior, so the requested release note is complete.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Independently reviewed the complete diff at 4019442: the RPC now explicitly opens a non-probe masternode connection, and the inbound-duplicate flag split preserves normal authentication and maintenance behavior; no actionable issues were found. The added release note resolves the prior documentation finding. This was a static review only; current CI checks for this head show successful builds, linting, and test jobs, including sanitizer and multiprocess configurations, with no checks pending or failing.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — This is a small, contained connection-intent fix and flag separation with focused regression tests, without intricate changes or changes to a qualifying critical surface. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 96% left, weekly 56% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
This pull request has conflicts, please rebase. |
… probe ef3f738 (the bitcoin#15759 merge) turned OpenMasternodeConnection's `bool probe = false` into `MasternodeProbeConn probe = MasternodeProbeConn::IsConnection`, flipping the default. The `masternode connect` RPC relies on that default, so since then it opens a probe: we never send our MNAUTH on it and drop it as soon as the peer's MNAUTH arrives, while the RPC still reports "successfully connected". Drop the default so every caller has to state its intent, and have the RPC ask for a regular masternode connection again. The new rpc_masternode.py scenarios check that the connection gets verified by both ends, and that a second connection between the same pair is settled by CMNAuth's duplicate resolution, which no functional test drove with real MNAUTH messages before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te inbound legs When CMNAuth finds a second verified connection to the same masternode and decides to keep the other one, it marks the inbound leg it gives up on by setting m_masternode_probe_connection, so that CMasternodeUtils::DoMaintenance disconnects it later. That gives one flag two meanings: an outbound reachability probe, and a superseded inbound duplicate. Give the duplicate mark its own field. The probe flag is only ever set on outbound connections, so on an inbound one it was always the duplicate mark, and of the flag's readers only the DoMaintenance drop loop could ever see that: the VERACK and first-message checks run before an MNAUTH can set it, and the others only look at outbound connections. That loop now checks both fields, so behavior is unchanged. State that probes are outbound only with an Assume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4019442 to
13975c7
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: The rebase picks up the base branch’s lock annotation and include changes without altering the masternode connect authentication fix, duplicate-inbound cleanup, or release note. GitHub reports no merge conflicts with develop; lint, ClangFormat, and Cppcheck passed, and source builds including Linux and ASan are still pending.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — The diff makes a small, contained change to the RPC’s connection mode and separates the duplicate-inbound marker from the probe flag without changing authentication or duplicate-selection rules. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(zai below 15% reserve: 5h 100% left, weekly 0% left) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— dash-core-commit-history (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
No actionable comments were generated in the recent review. Walkthrough
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant MasternodeRPC
participant CConnman
participant Peer
Operator->>MasternodeRPC: Call masternode_connect
MasternodeRPC->>CConnman: OpenMasternodeConnection with IsNotConnection
CConnman->>Peer: Open ordinary masternode connection
Peer-->>CConnman: Complete authenticated connection
Suggested reviewers: Merge Risk:
|
Potential PR merge conflictsThis is advisory only. It does not block CI. This PR and each open PR below change the same files and cannot be merged together cleanly, so whichever of the two merges second will likely need a rebase:
|
Issue being fixed or feature implemented
Since ef3f738 (the bitcoin#15759 merge, #4862, 2022),
masternode connectopens a masternode probe rather than a masternode connection, and still reports success. That merge turnedOpenMasternodeConnection(const CAddress&, bool probe = false)into an enum parameter whose default,MasternodeProbeConn::IsConnection, means "this is a probe". The RPC is the only caller that relies on the default. So we never send our MNAUTH on the connection, and we drop it as soon as the peer's MNAUTH arrives ("Masternode probe successful for …, disconnecting"), after the RPC has already returned "successfully connected".Separately, CMNAuth reuses
m_masternode_probe_connectionto mark a verified inbound connection it gives up on in favour of another connection to the same masternode. One flag therefore means "outbound probe" in one direction and "superseded duplicate" in the other.What was done?
fix(net): make masternode connect open a masternode connection, not a proberemoves the default, so every caller states its intent, and the RPC passesMasternodeProbeConn::IsNotConnection. The only other caller,ThreadOpenMasternodeConnections, already passes its value explicitly. Newrpc_masternode.pyscenarios check two things:masternode connectyields one connection that both ends have verified.masternode connect, in the reverse direction, is settled by CMNAuth's duplicate resolution into one verified connection, seen from both ends. No functional test drove that logic with real MNAUTH messages before, because the regtestmnauthRPC bypassesCMNAuth::ProcessMessage. Which side logs the resolution depends on the order of the two proTxHashes, so the test accepts either side.refactor(net): stop reusing the masternode probe flag to mark duplicate inbound legsdoes three things:m_masternode_duplicate_inboundfield, and hasCMasternodeUtils::DoMaintenancecheck both fields;Assume(!probe || !inbound);m_masternode_connectioncomment named a function that no longer exists.Why the refactor preserves behavior. The probe flag is written only by
OpenNetworkConnection, which asserts that the connection is not inbound, and by CMNAuth, which writes it only on inbound connections. So on an inbound node the flag always was the duplicate mark. Only one reader of the flag could ever see that:IsFullOutboundConn().DoMaintenance's non-masternode count!IsInboundConn()conjunct.DoMaintenance's drop loopThe duplicate-resolution branches and their log strings are unchanged, and so are
TryMarkVerified, the per-protx inbound cap, andDoMaintenance's gating and timing. One difference is reachable, through the regtest-onlymnauthRPC. Suppose a connection is marked verified through that RPC before it has sent any post-VERACK message, and a real MNAUTH on another connection then marks it as a duplicate. It used to be dropped on its first message; now it waits forDoMaintenance. No test does this.Behavior note. On a well-connected node, one with at least as many non-masternode peers as automatic outbound slots,
DoMaintenancestill closes amasternode connectlink to a masternode that is not one of our quorum or relay members within about a minute. That was also the behavior before 2022. On nodes with fewer peers, including regtest, the link stays up.How Has This Been Tested?
Built with
--enable-debug --enable-werror. On develop's C++, the first new scenario fails: the node logs "Masternode probe successful for …, disconnecting", and the wait for a verified link times out. Both scenarios pass on the first commit alone and on the final head. The final head also passesevo_mnauth_tests,net_testsanddenialofservice_testsintest_dash, plusrpc_mnauth.py,feature_llmq_connections.py,p2p_quorum_data.pyandfeature_llmq_simplepose.py(with and without--disable-spork23). The second scenario also passes before the refactor, as expected for a behavior-preserving change.Breaking Changes
None. The only P2P difference is that
masternode connectconnections are ordinary masternode connections again, so we now send MNAUTH on them.Checklist:
🤖 Generated with Claude Code