Cleanup transaction set sync map creation.

Remove a passthrough to NetworkOPs that doesn't make much sense.
This commit is contained in:
JoelKatz
2012-09-13 15:21:08 -07:00
parent 9cdcf50c07
commit de8288d4d5
3 changed files with 10 additions and 15 deletions

View File

@@ -25,8 +25,7 @@ typedef std::pair<const uint256, LCTransaction::pointer> u256_lct_pair;
TransactionAcquire::TransactionAcquire(const uint256& hash) : PeerSet(hash, TX_ACQUIRE_TIMEOUT), mHaveRoot(false)
{
mMap = boost::make_shared<SHAMap>();
mMap->setSynching();
mMap = boost::make_shared<SHAMap>(hash);
}
void TransactionAcquire::done()
@@ -34,10 +33,10 @@ void TransactionAcquire::done()
if (mFailed)
{
Log(lsWARNING) << "Failed to acqiure TXs " << mHash;
theApp->getOPs().mapComplete(mHash, SHAMap::pointer());
mapComplete(mHash, SHAMap::pointer(), true);
}
else
theApp->getOPs().mapComplete(mHash, mMap);
mapComplete(mHash, mMap, true);
}
boost::weak_ptr<PeerSet> TransactionAcquire::pmDowncast()
@@ -376,7 +375,7 @@ void LedgerConsensus::takeInitialPosition(Ledger& initialLedger)
}
void LedgerConsensus::createDisputes(const SHAMap::pointer& m1, const SHAMap::pointer& m2)
{
{ // m2 must be immutable
SHAMap::SHAMapDiff differences;
m1->compare(m2, differences, 16384);
for (SHAMap::SHAMapDiff::iterator pos = differences.begin(), end = differences.end(); pos != end; ++pos)
@@ -419,7 +418,8 @@ void LedgerConsensus::mapComplete(const uint256& hash, const SHAMap::pointer& ma
assert((it2->first == mOurPosition->getCurrentHash()) && it2->second);
createDisputes(it2->second, map);
}
else assert(false); // We don't have our own position?!
else
assert(false); // We don't have our own position?!
}
mComplete[map->getHash()] = map;
@@ -868,8 +868,10 @@ bool LedgerConsensus::peerGaveNodes(Peer::ref peer, const uint256& setHash,
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData)
{
boost::unordered_map<uint256, TransactionAcquire::pointer>::iterator acq = mAcquiring.find(setHash);
if (acq == mAcquiring.end()) return false;
return acq->second->takeNodes(nodeIDs, nodeData, peer);
if (acq == mAcquiring.end())
return false;
return
acq->second->takeNodes(nodeIDs, nodeData, peer);
}
void LedgerConsensus::beginAccept()

View File

@@ -712,12 +712,6 @@ bool NetworkOPs::hasTXSet(const boost::shared_ptr<Peer>& peer, const uint256& se
return mConsensus->peerHasSet(peer, set, status);
}
void NetworkOPs::mapComplete(const uint256& hash, const SHAMap::pointer& map)
{
if (mConsensus)
mConsensus->mapComplete(hash, map, true);
}
void NetworkOPs::endConsensus(bool correctLCL)
{
uint256 deadLedger = theApp->getMasterLedger().getClosedLedger()->getParentHash();

View File

@@ -171,7 +171,6 @@ public:
bool recvValidation(const SerializedValidation::pointer& val);
SHAMap::pointer getTXMap(const uint256& hash);
bool hasTXSet(const boost::shared_ptr<Peer>& peer, const uint256& set, newcoin::TxSetStatus status);
void mapComplete(const uint256& hash, const SHAMap::pointer& map);
// network state machine
void checkState(const boost::system::error_code& result);