Simplify the way we handle validations. Include a signing time instead of a

closing time. Keep only the validation with the most recent signing time.
Sign using network time. This eliminates the ValidationPair nightmare and
makes the logic must easier to understand, increasing confidence that it
does what it's supposed to do.
This commit is contained in:
JoelKatz
2012-09-03 20:13:57 -07:00
parent 0862ed2957
commit 4930ebb945
9 changed files with 57 additions and 89 deletions

View File

@@ -25,7 +25,7 @@
NetworkOPs::NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster) :
mMode(omDISCONNECTED),mNetTimer(io_service), mLedgerMaster(pLedgerMaster), mCloseTimeOffset(0),
mLastCloseProposers(0), mLastCloseConvergeTime(LEDGER_IDLE_INTERVAL)
mLastCloseProposers(0), mLastCloseConvergeTime(LEDGER_IDLE_INTERVAL), mLastValidationTime(0)
{
}
@@ -46,6 +46,15 @@ uint32 NetworkOPs::getCloseTimeNC()
return iToSeconds(getNetworkTimePT() + boost::posix_time::seconds(mCloseTimeOffset));
}
uint32 NetworkOPs::getValidationTimeNC()
{
uint32 vt = getNetworkTimeNC();
if (vt >= mLastValidationTime)
vt = mLastValidationTime + 1;
mLastValidationTime = vt;
return vt;
}
void NetworkOPs::closeTimeOffset(int offset)
{
mCloseTimeOffset += offset / 4;