-
Notifications
You must be signed in to change notification settings - Fork 20
Description
I attempted to use requests::ServerInfo
to query the server state, but encountered an issue where the result
field in the response was deserialized as results::Subscribe
instead of results::ServerInfo
.
This happens because the server_state_duration_us
field in results::ServerInfo
is currently typed as u64
, while the Ripple documentation specifies it as a string:
link
Due to this type mismatch, Serde fails to match the response to results::ServerInfo
, and instead falls back to the results::Subscribe
variant, which contains only a phantom field and acting as a catch-all in this case.
I don’t have permission to push a new branch and open a pull request. It would be helpful if you could either grant the necessary permissions or apply the following diff to correct the issue:
diff --git a/src/models/results/server_info.rs b/src/models/results/server_info.rs
index a7b9450..e3214e6 100644
--- a/src/models/results/server_info.rs
+++ b/src/models/results/server_info.rs
@@ -60,7 +60,7 @@ pub struct Info<'a> {
/// Current server state
pub server_state: Cow<'a, str>,
/// Microseconds in current state
- pub server_state_duration_us: Option<u64>,
+ pub server_state_duration_us: Option<Cow<'a, str>>,
/// Server state accounting information
pub state_accounting: Option<Value>,
/// Current UTC time according to server
@@ -176,7 +176,7 @@ mod tests {
],
"pubkey_node": "n9KQK8yvTDcZdGyhu2EGdDnFPEBSsY5wEGpU5GgpygTgLFsjQyPt",
"server_state": "full",
- "server_state_duration_us": 91758491912,
+ "server_state_duration_us": "91758491912",
"time": "2023-Sep-13 22:12:31.377492 UTC",
"uptime": 91948,
"validated_ledger": {
@@ -208,7 +208,7 @@ mod tests {
"n9KQK8yvTDcZdGyhu2EGdDnFPEBSsY5wEGpU5GgpygTgLFsjQyPt"
);
assert_eq!(result.info.server_state, "full");
- assert_eq!(result.info.server_state_duration_us, Some(91758491912));
+ assert_eq!(result.info.server_state_duration_us, Some("91758491912".into()));
assert_eq!(
result.info.time,
Some("2023-Sep-13 22:12:31.377492 UTC".into())