Refactor consensus for simulation (RIPD-1011):

This is a substantial refactor of the consensus code and also introduces
a basic consensus simulation and testing framework.  The new generic/templated
version is in src/ripple/consensus and documents the current type requirements.
The version adapted for the RCL is in src/ripple/app/consensus.  The testing
framework is in src/test/csf.

Minor behavioral changes/fixes include:
* Adjust close time offset even when not validating.
* Remove spurious proposing_ = false call at end of handleLCL.
* Remove unused functionality provided by checkLastValidation.
* Separate open and converge time
* Don't send a bow out if we're not proposing
* Prevent consensus stopping if NetworkOPs switches to disconnect mode while
  consensus accepts a ledger
* Prevent a corner case in which Consensus::gotTxSet or Consensus::peerProposal
  has the potential to update internal state while an dispatched accept job is
  running.
* Distinguish external and internal calls to startNewRound.  Only external
  calls can reset the proposing_ state of consensus
This commit is contained in:
Brad Chase
2016-11-02 15:16:02 -07:00
parent fc0d64f5ee
commit bc5a74057d
56 changed files with 6492 additions and 3785 deletions

View File

@@ -54,6 +54,7 @@
#include <ripple/resource/Fees.h>
#include <ripple/beast/asio/io_latency_probe.h>
#include <ripple/beast/core/LexicalCast.h>
#include <fstream>
namespace ripple {
@@ -1338,7 +1339,6 @@ ApplicationImp::startGenesisLedger()
*genesis, timeKeeper().closeTime());
next->updateSkipList ();
next->setImmutable (*config_);
m_networkOPs->setLastCloseTime (next->info().closeTime);
openLedger_.emplace(next, cachedSLEs_,
logs_->journal("OpenLedger"));
m_ledgerMaster->storeLedger(next);
@@ -1648,7 +1648,6 @@ bool ApplicationImp::loadOldLedger (
m_ledgerMaster->switchLCL (loadLedger);
loadLedger->setValidated();
m_ledgerMaster->setFullLedger(loadLedger, true, false);
m_networkOPs->setLastCloseTime (loadLedger->info().closeTime);
openLedger_.emplace(loadLedger, cachedSLEs_,
logs_->journal("OpenLedger"));