From 1ab267876b577a3db3d620855b073a34474a0143 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 28 May 2012 01:34:50 -0700 Subject: [PATCH] Some additional comments. --- src/LedgerConsensus.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LedgerConsensus.cpp b/src/LedgerConsensus.cpp index d7cb4b5863..4039b8c3f3 100644 --- a/src/LedgerConsensus.cpp +++ b/src/LedgerConsensus.cpp @@ -125,8 +125,10 @@ bool LCTransaction::updatePosition(int seconds) if (mOurPosition && (mNays == 0)) return false; if (!mOurPosition && (mYays == 0)) return false; + // This is basically the percentage of nodes voting 'yes' (including us) int weight = (mYays * 100 + (mOurPosition ? 100 : 0)) / (mNays + mYays + 1); + // To prevent avalanche stalls, we increase the needed weight slightly over time bool newPosition; if (seconds <= LEDGER_CONVERGE) newPosition = weight >= MIN_CONSENSUS; else if (seconds >= LEDGER_FORCE_CONVERGE) newPosition = weight >= MAX_CONSENSUS;