Bugfixes to code to get into sync during consensus phase.

This commit is contained in:
JoelKatz
2012-07-14 02:24:00 -07:00
parent 532a103ef8
commit b516cdcf04
2 changed files with 10 additions and 0 deletions

View File

@@ -203,7 +203,14 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::pointer pre
previousLedger->getCloseResolution(), previousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1); previousLedger->getCloseResolution(), previousLedger->getCloseAgree(), previousLedger->getLedgerSeq() + 1);
if (previousLedger->getHash() != prevLCLHash) if (previousLedger->getHash() != prevLCLHash)
{
mHaveCorrectLCL = mProposing = mValidating = false; mHaveCorrectLCL = mProposing = mValidating = false;
mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(prevLCLHash);
std::vector<Peer::pointer> peers=theApp->getConnectionPool().getPeerVector();
for (std::vector<Peer::pointer>::const_iterator it = peerList.begin(), end = peerList.end(); it != end; ++it)
if (((*it)->hasLedger(closedLedger))
mAcquiringLedger->peerHash(*it);
}
else if (mValSeed.isValid()) else if (mValSeed.isValid())
{ {
mValidating = true; mValidating = true;
@@ -421,6 +428,7 @@ void LedgerConsensus::timerEntry()
{ {
if (!mHaveCorrectLCL) if (!mHaveCorrectLCL)
{ {
Log(lsINFO) << "Checking if we have the consensus ledger";
Ledger::pointer consensus = theApp->getMasterLedger().getLedgerByHash(mPrevLedgerHash); Ledger::pointer consensus = theApp->getMasterLedger().getLedgerByHash(mPrevLedgerHash);
if (consensus) if (consensus)
{ {
@@ -430,6 +438,7 @@ void LedgerConsensus::timerEntry()
mPreviousLedger = consensus; mPreviousLedger = consensus;
mHaveCorrectLCL = true; mHaveCorrectLCL = true;
} }
else Log(lsINFO) << "We still don't have it";
} }
mCurrentSeconds = (mCloseTime != 0) ? (theApp->getOPs().getNetworkTimeNC() - mCloseTime) : 0; mCurrentSeconds = (mCloseTime != 0) ? (theApp->getOPs().getNetworkTimeNC() - mCloseTime) : 0;

View File

@@ -82,6 +82,7 @@ protected:
uint32 mCloseTime; // The wall time this ledger closed uint32 mCloseTime; // The wall time this ledger closed
uint256 mPrevLedgerHash, mNewLedgerHash; uint256 mPrevLedgerHash, mNewLedgerHash;
Ledger::pointer mPreviousLedger; Ledger::pointer mPreviousLedger;
LedgerAcquire::pointer mAcquiringLedger;
LedgerProposal::pointer mOurPosition; LedgerProposal::pointer mOurPosition;
NewcoinAddress mValSeed; NewcoinAddress mValSeed;
bool mProposing, mValidating, mHaveCorrectLCL; bool mProposing, mValidating, mHaveCorrectLCL;