From 2f369e175c5d23776742846114721f7c2db4280a Mon Sep 17 00:00:00 2001 From: cyan317 <120398799+cindyyan317@users.noreply.github.com> Date: Wed, 12 Jul 2023 12:09:08 +0100 Subject: [PATCH] Add "network_id" to server_info (#761) Fixes #763 --- src/rpc/handlers/ServerInfo.h | 1 + unittests/rpc/handlers/ServerInfoTest.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rpc/handlers/ServerInfo.h b/src/rpc/handlers/ServerInfo.h index 6924abd5..f63497b6 100644 --- a/src/rpc/handlers/ServerInfo.h +++ b/src/rpc/handlers/ServerInfo.h @@ -189,6 +189,7 @@ private: jv.as_object()[JS(load_factor)] = rippledInfo.at(JS(load_factor)); jv.as_object()[JS(validation_quorum)] = rippledInfo.at(JS(validation_quorum)); jv.as_object()["rippled_version"] = rippledInfo.at(JS(build_version)); + jv.as_object()[JS(network_id)] = rippledInfo.at(JS(network_id)); } catch (std::exception const&) { diff --git a/unittests/rpc/handlers/ServerInfoTest.cpp b/unittests/rpc/handlers/ServerInfoTest.cpp index d29dfbd7..65e8a1eb 100644 --- a/unittests/rpc/handlers/ServerInfoTest.cpp +++ b/unittests/rpc/handlers/ServerInfoTest.cpp @@ -115,6 +115,8 @@ protected: EXPECT_EQ(info.at("validation_quorum").as_int64(), 456); EXPECT_TRUE(info.contains("rippled_version")); EXPECT_STREQ(info.at("rippled_version").as_string().c_str(), "1234"); + EXPECT_TRUE(info.contains("network_id")); + EXPECT_EQ(info.at("network_id").as_int64(), 2); } void @@ -290,7 +292,8 @@ TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesPresent) "info": { "build_version": "1234", "validation_quorum": 456, - "load_factor": 234 + "load_factor": 234, + "network_id": 2 } } })");