Skip to content

Commit

Permalink
[FOLD] Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bachase committed Oct 22, 2017
1 parent 80b1093 commit 5eb3b55
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
7 changes: 6 additions & 1 deletion src/ripple/app/misc/impl/ValidatorList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ ValidatorList::getJson() const
res[jss::validation_quorum] = static_cast<Json::UInt>(quorum());

if (auto when = expires())
res[jss::validator_list_expires] = to_string(*when);
{
if (*when == TimeKeeper::time_point::max())
res[jss::validator_list_expires] = "never";
else
res[jss::validator_list_expires] = to_string(*when);
}
else
res[jss::validator_list_expires] = "unknown";

Expand Down
4 changes: 2 additions & 2 deletions src/ripple/rpc/handlers/Handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Json::Value doWalletPropose (RPC::Context&);
Json::Value doWalletSeed (RPC::Context&);
Json::Value doWalletUnlock (RPC::Context&);
Json::Value doWalletVerify (RPC::Context&);
Json::Value doValidatorLists (RPC::Context&);
Json::Value doValidatorSites (RPC::Context&);
Json::Value doValidators (RPC::Context&);
Json::Value doValidatorListSites (RPC::Context&);
} // ripple

#endif
11 changes: 7 additions & 4 deletions src/test/app/ValidatorSite_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,13 @@ class ValidatorSite_test : public beast::unit_test::suite
while (list2.size () < listSize)
list2.push_back (randomNode());

std::uint16_t constexpr port1 = 7475;
std::uint16_t constexpr port2 = 7476;

using endpoint_type = boost::asio::ip::tcp::endpoint;
using address_type = boost::asio::ip::address;

endpoint_type ep1{address_type::from_string("127.0.0.1"), port1};
endpoint_type ep2{address_type::from_string("127.0.0.1"), port2};
// Use ports of 0 to allow OS selection
endpoint_type ep1{address_type::from_string("127.0.0.1"), 0};
endpoint_type ep2{address_type::from_string("127.0.0.1"), 0};

auto const sequence = 1;
auto const version = 1;
Expand All @@ -190,6 +189,10 @@ class ValidatorSite_test : public beast::unit_test::suite
version,
list2);

std::uint16_t const port1 = server1.local_endpoint().port();
std::uint16_t const port2 = server2.local_endpoint().port();


{
// fetch single site
std::vector<std::string> cfgSites(
Expand Down
7 changes: 2 additions & 5 deletions src/test/rpc/ValidatorRPC_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ class ValidatorRPC_test : public beast::unit_test::suite
{
auto const jrr = env.rpc("server_info")[jss::result];
BEAST_EXPECT(
jrr[jss::info][jss::validator_list_expires] ==
"never");
jrr[jss::info][jss::validator_list_expires] == "never");
}
{
auto const jrr = env.rpc("server_state")[jss::result];
Expand All @@ -149,9 +148,7 @@ class ValidatorRPC_test : public beast::unit_test::suite
// All our keys are in the response
{
auto const jrr = env.rpc("validators")[jss::result];
BEAST_EXPECT(
jrr[jss::validator_list_expires] ==
to_string(NetClock::time_point::max()));
BEAST_EXPECT(jrr[jss::validator_list_expires] == "never");
BEAST_EXPECT(jrr[jss::validation_quorum].asUInt() == keys.size());
BEAST_EXPECT(jrr[jss::trusted_validator_keys].size() == keys.size());
BEAST_EXPECT(jrr[jss::publisher_lists].size() == 0);
Expand Down

0 comments on commit 5eb3b55

Please sign in to comment.