Skip to content

Commit

Permalink
Replace Uint192 with Hash192 in server_definitions response (#5177)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnxie999 authored Nov 6, 2024
1 parent 9e48fc0 commit 7b18006
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/test/rpc/ServerInfo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ admin = 127.0.0.1
.asUInt() == 0);
BEAST_EXPECT(
result[jss::result][jss::TYPES]["AccountID"].asUInt() == 8);

// test that base_uint types are replaced with "Hash" prefix
{
auto const types = result[jss::result][jss::TYPES];
BEAST_EXPECT(types["Hash128"].asUInt() == 4);
BEAST_EXPECT(types["Hash160"].asUInt() == 17);
BEAST_EXPECT(types["Hash192"].asUInt() == 21);
BEAST_EXPECT(types["Hash256"].asUInt() == 5);
}
}

// test providing the same hash
Expand Down
3 changes: 2 additions & 1 deletion src/xrpld/rpc/handlers/ServerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ ServerDefinitions::translate(std::string const& inp)

if (contains("UINT"))
{
if (contains("256") || contains("160") || contains("128"))
if (contains("256") || contains("192") || contains("160") ||
contains("128"))
return replace("UINT", "Hash");
else
return replace("UINT", "UInt");
Expand Down

0 comments on commit 7b18006

Please sign in to comment.