-
Notifications
You must be signed in to change notification settings - Fork 3
fix(rpc): GetNetworkInfoResult field names are invalid #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rpc): GetNetworkInfoResult field names are invalid #143
Conversation
WalkthroughUpdated 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this 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 keysAdd #[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
📒 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
|
@PastaPastaPasta please review if this change is okay. |
This pull request updates the
GetNetworkInfoResultstruct inrpc-json/src/lib.rsto 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:
GetNetworkInfoResultto use the new naming conventions, such asconnections_in,connections_out,connections_mn,connections_mn_in, andconnections_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