Add ledger remove from acquire set. Cleanups.

This commit is contained in:
JoelKatz
2012-05-04 03:33:37 -07:00
parent 8bf477acac
commit d29733aa11
2 changed files with 67 additions and 60 deletions

View File

@@ -20,7 +20,7 @@ void LedgerAcquire::done()
mOnComplete.empty();
mLock.unlock();
for(int i=0; i<triggers.size(); i++)
for (int i = 0; i<triggers.size(); ++i)
triggers[i](shared_from_this());
}
@@ -271,6 +271,12 @@ bool LedgerAcquireMaster::hasLedger(const uint256& hash)
return mLedgers.find(hash) != mLedgers.end();
}
bool LedgerAcquireMaster::dropLedger(const uint256& hash)
{
boost::mutex::scoped_lock sl(mLock);
return mLedgers.erase(hash);
}
bool LedgerAcquireMaster::gotLedgerData(newcoin::TMLedgerData& packet)
{
uint256 hash;
@@ -293,7 +299,7 @@ bool LedgerAcquireMaster::gotLedgerData(newcoin::TMLedgerData& packet)
std::list<std::vector<unsigned char> > nodeData;
if (packet.nodes().size()<=0) return false;
for(int i=0; i<packet.nodes().size(); i++)
for (int i = 0; i<packet.nodes().size(); ++i)
{
const newcoin::TMLedgerNode& node=packet.nodes(i);
if (!node.has_nodeid() || !node.has_nodedata()) return false;

View File

@@ -64,6 +64,7 @@ public:
LedgerAcquire::pointer findCreate(const uint256& hash);
LedgerAcquire::pointer find(const uint256& hash);
bool hasLedger(const uint256& ledgerHash);
bool dropLedger(const uint256& ledgerHash);
bool gotLedgerData(newcoin::TMLedgerData& packet);
};