Fix crash when using open ledger to take initial position.

This commit is contained in:
JoelKatz
2013-03-05 23:38:05 -08:00
parent 1c9b4840d6
commit 7f29336d0b

View File

@@ -595,10 +595,14 @@ public:
void NetworkOPs::checkState(const boost::system::error_code& result) void NetworkOPs::checkState(const boost::system::error_code& result)
{ // Network state machine { // Network state machine
if ((result == boost::asio::error::operation_aborted) || theConfig.RUN_STANDALONE) if ((result == boost::asio::error::operation_aborted) || theConfig.RUN_STANDALONE)
return; return;
setStateTimer(); setStateTimer();
ScopedLock(theApp->getMasterLock());
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector(); std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
// do we have sufficient peers? If not, we are disconnected. // do we have sufficient peers? If not, we are disconnected.
@@ -618,12 +622,9 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
cLog(lsINFO) << "Node count (" << peerList.size() << ") is sufficient."; cLog(lsINFO) << "Node count (" << peerList.size() << ") is sufficient.";
} }
if (mConsensus) if (!mConsensus)
{ tryStartConsensus();
mConsensus->timerEntry();
return;
}
tryStartConsensus();
if (mConsensus) if (mConsensus)
mConsensus->timerEntry(); mConsensus->timerEntry();
} }
@@ -632,7 +633,7 @@ void NetworkOPs::tryStartConsensus()
{ {
uint256 networkClosed; uint256 networkClosed;
bool ledgerChange = checkLastClosedLedger(theApp->getConnectionPool().getPeerVector(), networkClosed); bool ledgerChange = checkLastClosedLedger(theApp->getConnectionPool().getPeerVector(), networkClosed);
if(networkClosed.isZero()) if (networkClosed.isZero())
return; return;
// WRITEME: Unless we are in omFULL and in the process of doing a consensus, // WRITEME: Unless we are in omFULL and in the process of doing a consensus,