Fix two more race conditions involving us taking our position late.

Remove an incorrect comment.
This commit is contained in:
JoelKatz
2012-09-17 00:38:47 -07:00
parent 53107d2325
commit 89518e23cc
2 changed files with 8 additions and 2 deletions

View File

@@ -358,13 +358,18 @@ void LedgerConsensus::takeInitialPosition(Ledger& initialLedger)
SHAMap::pointer initialSet = initialLedger.peekTransactionMap()->snapShot(false);
uint256 txSet = initialSet->getHash();
Log(lsINFO) << "initial position " << txSet;
mapComplete(txSet, initialSet, false);
if (mValidating)
mOurPosition = boost::make_shared<LedgerProposal>
(mValSeed, initialLedger.getParentHash(), txSet, mCloseTime);
else
mOurPosition = boost::make_shared<LedgerProposal>(initialLedger.getParentHash(), txSet, mCloseTime);
mapComplete(txSet, initialSet, false);
BOOST_FOREACH(u256_lct_pair& it, mDisputes)
{
it.second->setOurVote(initialLedger.hasTransaction(it.first));
}
// if any peers have taken a contrary position, process disputes
boost::unordered_set<uint256> found;
@@ -372,7 +377,7 @@ void LedgerConsensus::takeInitialPosition(Ledger& initialLedger)
{
uint256 set = it.second->getCurrentHash();
if (found.insert(set).second)
{ // OPTIMIZEME: Don't process the same set more than once
{
boost::unordered_map<uint256, SHAMap::pointer>::iterator iit = mAcquired.find(set);
if (iit != mAcquired.end())
createDisputes(initialSet, iit->second);

View File

@@ -62,6 +62,7 @@ public:
const uint256& getTransactionID() const { return mTransactionID; }
bool getOurVote() const { return mOurVote; }
Serializer& peekTransaction() { return transaction; }
void setOurVote(bool o) { mOurVote = o; }
void setVote(const uint160& peer, bool votesYes);
void unVote(const uint160& peer);