Add NetworkID field to Transaction common fields, enforced when network id > 1024

This commit is contained in:
Richard Holland
2022-12-19 13:43:32 +00:00
parent 05f961c77c
commit 39ecdb6795
14 changed files with 268 additions and 0 deletions

View File

@@ -411,6 +411,71 @@ port_wss_admin
}
}
void
testNetworkID()
{
testcase("network id");
std::string error;
Config c;
try
{
c.loadFromString(R"rippleConfig(
[network_id]
main
)rippleConfig");
}
catch (std::runtime_error& e)
{
error = e.what();
}
BEAST_EXPECT(error == "");
BEAST_EXPECT(c.NETWORK_ID == 0);
try
{
c.loadFromString(R"rippleConfig(
)rippleConfig");
}
catch (std::runtime_error& e)
{
error = e.what();
}
BEAST_EXPECT(error == "");
BEAST_EXPECT(c.NETWORK_ID == 0);
try
{
c.loadFromString(R"rippleConfig(
[network_id]
255
)rippleConfig");
}
catch (std::runtime_error& e)
{
error = e.what();
}
BEAST_EXPECT(error == "");
BEAST_EXPECT(c.NETWORK_ID == 255);
try
{
c.loadFromString(R"rippleConfig(
[network_id]
10000
)rippleConfig");
}
catch (std::runtime_error& e)
{
error = e.what();
}
BEAST_EXPECT(error == "");
BEAST_EXPECT(c.NETWORK_ID == 10000);
}
void
testValidatorsFile()
{
@@ -1151,6 +1216,7 @@ r.ripple.com 51235
testGetters();
testAmendment();
testOverlay();
testNetworkID();
}
};