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 24, 2017
1 parent 1ff43a3 commit f3edb6a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/ripple/app/misc/impl/ValidatorSite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ ValidatorSite::onSiteFetch(
JLOG (j_.warn()) <<
"Request for validator list at " <<
sites_[siteIdx].uri << " returned " << res.result_int();

sites_[siteIdx].lastRefreshStatus.emplace(
Site::Status{clock_type::now(), ListDisposition::invalid});
}
else if (! ec)
{
Expand Down Expand Up @@ -294,6 +297,7 @@ ValidatorSite::onSiteFetch(
}
else
{
std::lock_guard <std::mutex> lock{sites_mutex_};
sites_[siteIdx].lastRefreshStatus.emplace(
Site::Status{clock_type::now(), ListDisposition::invalid});

Expand Down
3 changes: 2 additions & 1 deletion src/test/app/ValidatorList_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ class ValidatorList_test : public beast::unit_test::suite
manifests, manifests, env.app().timeKeeper(), journal);

std::vector<PublicKey> valKeys = {randomNode()};

hash_set<PublicKey> activeKeys{valKeys.begin(), valKeys.end()};
// Store prepared list data to control when it is applied
struct PreparedList
{
Expand Down Expand Up @@ -1007,6 +1007,7 @@ class ValidatorList_test : public beast::unit_test::suite
// Advance past the first list's expiration, but it remains the
// earliest expiration
env.timeKeeper().set(prep1.expiration + 1s);
trustedKeys->onConsensusStart(activeKeys);
BEAST_EXPECT(
trustedKeys->expires() &&
trustedKeys->expires().get() == prep1.expiration);
Expand Down
8 changes: 6 additions & 2 deletions src/test/rpc/ValidatorRPC_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ class ValidatorRPC_test : public beast::unit_test::suite
return cfg;
}),
};

env.app().validatorSites().start();
env.app().validatorSites().join();

{
auto const jrr = env.rpc("server_info")[jss::result];
BEAST_EXPECT(
Expand Down Expand Up @@ -247,8 +251,8 @@ class ValidatorRPC_test : public beast::unit_test::suite
auto js = jrr[jss::validator_sites][0u];
BEAST_EXPECT(js[jss::refresh_interval_min].asUInt() == 5);
BEAST_EXPECT(js[jss::uri] == siteURI);
BEAST_EXPECT(!js.isMember(jss::last_refresh_time));
BEAST_EXPECT(!js.isMember(jss::last_refresh_status));
BEAST_EXPECT(js.isMember(jss::last_refresh_time));
BEAST_EXPECT(js[jss::last_refresh_status] == "invalid");
}
}
}
Expand Down

0 comments on commit f3edb6a

Please sign in to comment.