Fetch validator lists from remote sites:

Validator lists from configured remote sites are fetched at a regular
interval. Fetched lists are expected to be in JSON format and contain the
following fields:

* "manifest": Base64-encoded serialization of a manifest containing the
  validator publisher's master and signing public keys.

* "blob": Base64-encoded JSON string containing a "sequence",
  "expiration" and "validators" field. "expiration" contains the Ripple
   timestamp (seconds since January 1st, 2000 (00:00 UTC)) for when the
  list expires. "validators" contains an array of objects with a
  "validation_public_key" field.

* "signature": Hex-encoded signature of the blob using the publisher's
  signing key.

* "version": 1

* "refreshInterval" (optional)
This commit is contained in:
wilsonianb
2016-11-02 16:14:31 -07:00
committed by seelabs
parent e823e60ca0
commit b45f45dcef
18 changed files with 1474 additions and 7 deletions

View File

@@ -45,6 +45,7 @@
#include <ripple/app/misc/TxQ.h>
#include <ripple/app/misc/Validations.h>
#include <ripple/app/misc/ValidatorList.h>
#include <ripple/app/misc/ValidatorSite.h>
#include <ripple/app/paths/Pathfinder.h>
#include <ripple/app/paths/PathRequests.h>
#include <ripple/app/tx/apply.h>
@@ -351,6 +352,7 @@ public:
std::unique_ptr <ManifestCache> validatorManifests_;
std::unique_ptr <ManifestCache> publisherManifests_;
std::unique_ptr <ValidatorList> validators_;
std::unique_ptr <ValidatorSite> validatorSites_;
std::unique_ptr <ServerHandler> serverHandler_;
std::unique_ptr <AmendmentTable> m_amendmentTable;
std::unique_ptr <LoadFeeTrack> mFeeTrack;
@@ -486,6 +488,9 @@ public:
*validatorManifests_, *publisherManifests_, *timeKeeper_,
logs_->journal("ValidatorList"), config_->VALIDATION_QUORUM))
, validatorSites_ (std::make_unique<ValidatorSite> (
get_io_service (), *validators_, logs_->journal("ValidatorSite")))
, serverHandler_ (make_ServerHandler (*this, *m_networkOPs, get_io_service (),
*m_jobQueue, *m_networkOPs, *m_resourceManager, *m_collectorManager))
@@ -701,6 +706,11 @@ public:
return *validators_;
}
ValidatorSite& validatorSites () override
{
return *validatorSites_;
}
ManifestCache& validatorManifests() override
{
return *validatorManifests_;
@@ -866,6 +876,8 @@ public:
mValidations->flush ();
validatorSites_->stop ();
// TODO Store manifests in manifests.sqlite instead of wallet.db
validatorManifests_->save (getWalletDB (), "ValidatorManifests",
[this](PublicKey const& pubKey)
@@ -1112,6 +1124,14 @@ bool ApplicationImp::setup()
return false;
}
if (!validatorSites_->load (
config().section (SECTION_VALIDATOR_LIST_SITES).values ()))
{
JLOG(m_journal.fatal()) <<
"Invalid entry in [" << SECTION_VALIDATOR_LIST_SITES << "]";
return false;
}
m_nodeStore->tune (config_->getSize (siNodeCacheSize), config_->getSize (siNodeCacheAge));
m_ledgerMaster->tune (config_->getSize (siLedgerSize), config_->getSize (siLedgerAge));
family().treecache().setTargetSize (config_->getSize (siTreeCacheSize));
@@ -1133,6 +1153,8 @@ bool ApplicationImp::setup()
*config_);
add (*m_overlay); // add to PropertyStream
validatorSites_->start ();
// start first consensus round
if (! m_networkOPs->beginConsensus(m_ledgerMaster->getClosedLedger()->info().hash))
{