Skip to content

refactor: remove default_peers_for_network from ClientConfig#592

Merged
QuantumExplorer merged 1 commit intov0.42-devfrom
refactor/remove-default-peers-for-network
Mar 30, 2026
Merged

refactor: remove default_peers_for_network from ClientConfig#592
QuantumExplorer merged 1 commit intov0.42-devfrom
refactor/remove-default-peers-for-network

Conversation

@xdustinface
Copy link
Copy Markdown
Collaborator

@xdustinface xdustinface commented Mar 29, 2026

The function returned empty peers for mainnet/testnet (already the Default behavior) and a hardcoded 127.0.0.1:19899 for regtest that no caller actually relied on — dashd tests always clear and add their own peer.

Summary by CodeRabbit

  • Refactor
    • Removed automatic peer initialization based on network configuration. Clients now require explicit peer configuration instead of relying on network-specific defaults.

The function returned empty peers for mainnet/testnet (already the
`Default` behavior) and a hardcoded `127.0.0.1:19899` for regtest that
no caller actually relied on — dashd tests always clear and add their
own peer.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 406251b0-0fde-4440-96e1-8addd9a01207

📥 Commits

Reviewing files that changed from the base of the PR and between 472131a and c7f03cf.

📒 Files selected for processing (3)
  • dash-spv/src/client/config.rs
  • dash-spv/src/client/config_test.rs
  • dash-spv/tests/dashd_sync/setup.rs
💤 Files with no reviewable changes (1)
  • dash-spv/src/client/config.rs

📝 Walkthrough

Walkthrough

The changes remove automatic network-specific peer initialization from ClientConfig::new(). The default_peers_for_network function is deleted entirely, and all networks now default to an empty peers list. Test assertions are updated to reflect empty peer lists as the expected baseline behavior.

Changes

Cohort / File(s) Summary
Config Module Refactoring
dash-spv/src/client/config.rs, dash-spv/src/client/config_test.rs
Removed default_peers_for_network() function and network-specific peer initialization logic. ClientConfig::new() now returns empty peers for all networks. Updated unit test to assert empty peer list instead of checking for hardcoded loopback address.
Test Setup Adaptation
dash-spv/tests/dashd_sync/setup.rs
Modified create_test_config() to retain existing default peers while adding target peer address, and removed explicit config.peers.clear() from create_non_exclusive_test_config(). Tests now rely on default empty peers and explicit peer additions rather than automatic initialization.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 No more peers by default, just an empty nest,
Each config now starts fresh, a blank canvas blessed,
The tests adapt gracefully to the new way,
Simplicity reigns—let the callers have their say! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: removing the default_peers_for_network function from ClientConfig and related peer initialization logic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/remove-default-peers-for-network

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.01%. Comparing base (fcdffa7) to head (c7f03cf).
⚠️ Report is 3 commits behind head on v0.42-dev.

Additional details and impacted files
@@              Coverage Diff              @@
##           v0.42-dev     #592      +/-   ##
=============================================
- Coverage      67.40%   67.01%   -0.40%     
=============================================
  Files            318      318              
  Lines          67020    67015       -5     
=============================================
- Hits           45175    44909     -266     
- Misses         21845    22106     +261     
Flag Coverage Δ
core 75.21% <ø> (ø)
ffi 34.12% <ø> (-2.33%) ⬇️
rpc 19.92% <ø> (ø)
spv 83.66% <100.00%> (-0.20%) ⬇️
wallet 66.97% <ø> (ø)
Files with missing lines Coverage Δ
dash-spv/src/client/config.rs 92.70% <ø> (+0.25%) ⬆️
dash-spv/src/client/config_test.rs 100.00% <100.00%> (ø)

... and 22 files with indirect coverage changes

@github-actions github-actions bot added the ready-for-review CodeRabbit has approved this PR label Mar 29, 2026
@QuantumExplorer QuantumExplorer merged commit 5718448 into v0.42-dev Mar 30, 2026
39 checks passed
@QuantumExplorer QuantumExplorer deleted the refactor/remove-default-peers-for-network branch March 30, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review CodeRabbit has approved this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants