Enchance /crawl API endpoint with local server information (RIPD-1644):

The /crawl API endpoint allows developers to examine the structure of
the XRP Ledger's overlay network.

This commit adds additional information about the local server to the
/crawl endpoint, making it possible for developers to create data-rich
network-wide status dashboards.

Related:
 - https://developers.ripple.com/peer-protocol.html
 - https://github.com/ripple/rippled-network-crawler
This commit is contained in:
Joseph Busch
2018-11-19 15:27:16 -06:00
committed by Nik Bougalis
parent ea76103d5f
commit 494724578a
11 changed files with 339 additions and 91 deletions

View File

@@ -190,13 +190,13 @@ ValidatorList::load (
return true;
}
ListDisposition
ValidatorList::applyList (
std::string const& manifest,
std::string const& blob,
std::string const& signature,
std::uint32_t version)
std::uint32_t version,
std::string siteUri)
{
if (version != requiredListVersion)
return ListDisposition::unsupported_version;
@@ -215,6 +215,7 @@ ValidatorList::applyList (
publisherLists_[pubKey].sequence = list["sequence"].asUInt ();
publisherLists_[pubKey].expiration = TimeKeeper::time_point{
TimeKeeper::duration{list["expiration"].asUInt()}};
publisherLists_[pubKey].siteUri = std::move(siteUri);
std::vector<PublicKey>& publisherList = publisherLists_[pubKey].list;
std::vector<PublicKey> oldList = publisherList;
@@ -544,6 +545,7 @@ ValidatorList::getJson() const
Json::Value& curr = jPublisherLists.append(Json::objectValue);
curr[jss::pubkey_publisher] = strHex(p.first);
curr[jss::available] = p.second.available;
curr[jss::uri] = p.second.siteUri;
if(p.second.expiration != TimeKeeper::time_point{})
{
curr[jss::seq] = static_cast<Json::UInt>(p.second.sequence);