Skip to content

Conversation

@lklimek
Copy link
Contributor

@lklimek lklimek commented Sep 16, 2025

This pull request updates the GetNetworkInfoResult struct in rpc-json/src/lib.rs to align field names with new naming conventions and adds a note regarding version validation. The changes primarily focus on renaming fields to match updated API responses and improving clarity.

Field renaming for consistency:

  • Renamed several connection-related fields in GetNetworkInfoResult to use the new naming conventions, such as connections_in, connections_out, connections_mn, connections_mn_in, and connections_mn_out, replacing the previous names (e.g., inboundconnections, outboundconnections, etc.) to better reflect their purpose and match the updated API schema.

Summary by CodeRabbit

  • Breaking Changes
    • Updated RPC JSON field names in the network info response:
      • connections_in (was inboundconnections)
      • connections_out (was outboundconnections)
      • connections_mn (was mnconnections)
      • connections_mn_in (was inboundmnconnections)
      • connections_mn_out (was outboundmnconnections)
    • Update any clients parsing the old keys to ensure compatibility.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Walkthrough

Updated serde JSON key mappings for five fields in GetNetworkInfoResult within rpc-json/src/lib.rs to new connection-related keys. Field types and struct layout remain unchanged. No additional logic or files were modified.

Changes

Cohort / File(s) Summary of Changes
RPC JSON mapping updates
rpc-json/src/lib.rs
Updated serde rename attributes for GetNetworkInfoResult fields: inbound_connections → "connections_in", outbound_connections → "connections_out", mn_connections → "connections_mn", inbound_mn_connections → "connections_mn_in", outbound_mn_connections → "connections_mn_out". No type or structural changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at JSON’s tune,
Keys hop paths beneath the moon.
In, out, MN—names align,
Burrows mapped and all is fine.
Packets scurry, fields remap—
Tip-tap paws commit the patch. 🐇✨

Pre-merge checks and finishing touches

✅ 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 concisely and accurately summarizes the primary change—correcting invalid field names in GetNetworkInfoResult—and directly reflects the serde JSON key mapping updates shown in the diff. It is specific, short, and relevant for a reviewer scanning history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/GetNetworkInfoResult-field-names

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
rpc-json/src/lib.rs (1)

86-95: Add serde aliases to accept legacy GetNetworkInfo keys

Add #[serde(alias = "...")] so deserialization accepts both old and new RPC keys — the new keys (connections_in/out, connections_mn*) appear in Dash Core docs/examples from v21.0.0 while older docs (v18) do not; serde supports the alias attribute. (docs.dash.org)

File: rpc-json/src/lib.rs (around lines 86-95)

-    #[serde(rename = "connections_in")]
+    #[serde(rename = "connections_in", alias = "inboundconnections")]
     pub inbound_connections: usize,
-    #[serde(rename = "connections_out")]
+    #[serde(rename = "connections_out", alias = "outboundconnections")]
     pub outbound_connections: usize,
-    #[serde(rename = "connections_mn")]
+    #[serde(rename = "connections_mn", alias = "mnconnections")]
     pub mn_connections: usize,
-    #[serde(rename = "connections_mn_in")]
+    #[serde(rename = "connections_mn_in", alias = "inboundmnconnections")]
     pub inbound_mn_connections: usize,
-    #[serde(rename = "connections_mn_out")]
+    #[serde(rename = "connections_mn_out", alias = "outboundmnconnections")]
     pub outbound_mn_connections: usize,

Also add a one-line doc comment to GetNetworkInfoResult noting that these fields changed in Dash Core v21.0.0 (so older nodes may return legacy names). (docs.dash.org)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b85df8 and 2ba29f9.

📒 Files selected for processing (1)
  • rpc-json/src/lib.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Use proper error types with thiserror and propagate errors appropriately
Use the tokio runtime for async operations in Rust
Use conditional compilation feature flags for optional features (#[cfg(feature = ...)])
Format Rust code with cargo fmt (and enforce via cargo fmt --check)
Run clippy with -D warnings and fix all lints
Adhere to MSRV Rust 1.89 (avoid features requiring newer compiler)

**/*.rs: Format Rust code with rustfmt (per rustfmt.toml); run cargo fmt --all before commits
Lint with clippy; treat warnings as errors in CI
Follow Rust naming: snake_case for functions/variables, UpperCamelCase for types/traits, SCREAMING_SNAKE_CASE for consts
Prefer async using tokio where applicable

Files:

  • rpc-json/src/lib.rs
**/src/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/src/**/*.rs: Each crate keeps sources in src/
Avoid unwrap()/expect() in library code; use proper error types (e.g., thiserror)
Place unit tests alongside code with #[cfg(test)]

Files:

  • rpc-json/src/lib.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Core Components Tests
  • GitHub Check: SPV Components Tests
  • GitHub Check: RPC Tests (stable, true)
  • GitHub Check: Strict Warnings and Clippy Checks

@QuantumExplorer
Copy link
Member

@PastaPastaPasta please review if this change is okay.

@QuantumExplorer QuantumExplorer merged commit 4a8ef2d into v0.40-dev Sep 27, 2025
24 of 25 checks passed
@QuantumExplorer QuantumExplorer deleted the fix/GetNetworkInfoResult-field-names branch September 27, 2025 06:52
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.

4 participants