Skip to content
This repository has been archived by the owner on Jan 18, 2019. It is now read-only.

Commit

Permalink
try another spot for force close
Browse files Browse the repository at this point in the history
  • Loading branch information
jed committed Nov 2, 2014
1 parent 07068da commit 529e90d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ripple_app/consensus/LedgerConsensus.cpp
Expand Up @@ -624,7 +624,7 @@ class LedgerConsensusImp
{

// Give everyone a chance to take an initial position
if (mCurrentMSeconds < LEDGER_MIN_CONSENSUS)
if(mCurrentMSeconds < LEDGER_MIN_CONSENSUS_TIME)
return;

updateOurPositions ();
Expand Down
24 changes: 18 additions & 6 deletions src/ripple_app/ledger/LedgerTiming.cpp
Expand Up @@ -43,6 +43,9 @@ bool ContinuousLedgerTiming::shouldClose (
{
if(gFORCE_CLOSE)
{
WriteLog(lsWARNING, LedgerTiming) <<
"CLC::shouldClose gFORCE_CLOSE ";

gFORCE_CLOSE = false;
return true;
}
Expand Down Expand Up @@ -119,15 +122,24 @@ bool ContinuousLedgerTiming::haveConsensus (
" time=" << currentAgreeTime << "/" << previousAgreeTime <<
(forReal ? "" : "X");

if (currentAgreeTime <= LEDGER_MIN_CONSENSUS)
if(gFORCE_CLOSE)
{
WriteLog(lsWARNING, LedgerTiming) <<
"CLC::haveConsensus gFORCE_CLOSE ";

gFORCE_CLOSE = false;
return true;
}

if(currentAgreeTime <= LEDGER_MIN_CONSENSUS_TIME)
return false;

if (currentProposers < (previousProposers * 3 / 4))
{
// Less than 3/4 of the last ledger's proposers are present, we may need more time
if (currentAgreeTime < (previousAgreeTime + LEDGER_MIN_CONSENSUS))
if(currentAgreeTime < (previousAgreeTime + LEDGER_MIN_CONSENSUS_TIME))
{
CondLog (forReal, lsTRACE, LedgerTiming) <<
WriteLog(lsTRACE, LedgerTiming) <<
"too fast, not enough proposers";
return false;
}
Expand All @@ -136,22 +148,22 @@ bool ContinuousLedgerTiming::haveConsensus (
// If 80% of current proposers (plus us) agree on a set, we have consensus
if (((currentAgree * 100 + 100) / (currentProposers + 1)) > 80)
{
CondLog (forReal, lsINFO, LedgerTiming) << "normal consensus";
WriteLog(lsTRACE, LedgerTiming) << "normal consensus";
failed = false;
return true;
}

// If 80% of the nodes on your UNL have moved on, you should declare consensus
if (((currentFinished * 100) / (currentProposers + 1)) > 80)
{
CondLog (forReal, lsWARNING, LedgerTiming) <<
WriteLog(lsTRACE, LedgerTiming) <<
"We see no consensus, but 80% of nodes have moved on";
failed = true;
return true;
}

// no consensus yet
CondLog (forReal, lsTRACE, LedgerTiming) << "no consensus";
WriteLog(lsTRACE, LedgerTiming) << "no consensus";
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ripple_app/ledger/LedgerTiming.h
Expand Up @@ -35,7 +35,7 @@ namespace ripple {
# define LEDGER_EARLY_INTERVAL 180

// The number of milliseconds we wait minimum to ensure participation
# define LEDGER_MIN_CONSENSUS 2000
# define LEDGER_MIN_CONSENSUS_TIME 3000

// The number of milliseconds we wait minimum to ensure others have computed the LCL
# define LEDGER_MIN_CLOSE 2000
Expand Down

0 comments on commit 529e90d

Please sign in to comment.