Fix a race condition in NetworkOPs::gotTXData

This commit is contained in:
JoelKatz
2013-06-28 16:30:37 -07:00
parent 18d4a0480c
commit f31ba16827

View File

@@ -1024,13 +1024,20 @@ void NetworkOPs::takePosition (int seq, SHAMap::ref position)
SHAMapAddNode NetworkOPs::gotTXData (const boost::shared_ptr<Peer>& peer, uint256 const& hash,
const std::list<SHAMapNode>& nodeIDs, const std::list< Blob >& nodeData)
{
if (!haveConsensusObject ())
boost::shared_ptr<LedgerConsensus> consensus;
{
ScopedLock mlh(theApp->getMasterLock());
consensus = mConsensus;
}
if (!consensus)
{
WriteLog (lsWARNING, NetworkOPs) << "Got TX data with no consensus object";
return SHAMapAddNode ();
}
return mConsensus->peerGaveNodes (peer, hash, nodeIDs, nodeData);
return consensus->peerGaveNodes (peer, hash, nodeIDs, nodeData);
}
bool NetworkOPs::hasTXSet (const boost::shared_ptr<Peer>& peer, uint256 const& set, protocol::TxSetStatus status)