mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
A collection of small bugfixes.
This commit is contained in:
@@ -115,15 +115,12 @@ Ledger::Ledger(const std::string& rawLedger, bool hasPrefix) :
|
||||
|
||||
void Ledger::setImmutable()
|
||||
{
|
||||
if (!mImmutable)
|
||||
{
|
||||
updateHash();
|
||||
mImmutable = true;
|
||||
if (mTransactionMap)
|
||||
mTransactionMap->setImmutable();
|
||||
if (mAccountStateMap)
|
||||
mAccountStateMap->setImmutable();
|
||||
}
|
||||
}
|
||||
|
||||
void Ledger::updateHash()
|
||||
@@ -1425,6 +1422,7 @@ void Ledger::pendSave(bool fromConsensus)
|
||||
{
|
||||
if (!fromConsensus && !theApp->isNewFlag(getHash(), SF_SAVED))
|
||||
return;
|
||||
assert(isImmutable());
|
||||
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(sPendingSaveLock);
|
||||
|
||||
@@ -158,6 +158,7 @@ public:
|
||||
SHAMap::ref peekAccountStateMap() { return mAccountStateMap; }
|
||||
void dropCache()
|
||||
{
|
||||
assert(isImmutable());
|
||||
if (mTransactionMap)
|
||||
mTransactionMap->dropCache();
|
||||
if (mAccountStateMap)
|
||||
|
||||
@@ -94,6 +94,9 @@ LedgerAcquire::LedgerAcquire(const uint256& hash) : PeerSet(hash, LEDGER_ACQUIRE
|
||||
|
||||
bool LedgerAcquire::tryLocal()
|
||||
{ // return value: true = no more work to do
|
||||
|
||||
if (!mHaveBase)
|
||||
{
|
||||
HashedObject::pointer node = theApp->getHashedObjectStore().retrieve(mHash);
|
||||
if (!node)
|
||||
{
|
||||
@@ -112,7 +115,10 @@ bool LedgerAcquire::tryLocal()
|
||||
}
|
||||
|
||||
mHaveBase = true;
|
||||
}
|
||||
|
||||
if (!mHaveTransactions)
|
||||
{
|
||||
if (mLedger->getTransHash().isZero())
|
||||
{
|
||||
cLog(lsDEBUG) << "No TXNs to fetch";
|
||||
@@ -135,7 +141,10 @@ bool LedgerAcquire::tryLocal()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mHaveState)
|
||||
{
|
||||
if (mLedger->getAccountHash().isZero())
|
||||
mHaveState = true;
|
||||
else
|
||||
@@ -155,12 +164,14 @@ bool LedgerAcquire::tryLocal()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mHaveTransactions && mHaveState)
|
||||
{
|
||||
cLog(lsDEBUG) << "Had everything locally";
|
||||
mComplete = true;
|
||||
mLedger->setClosed();
|
||||
mLedger->setImmutable();
|
||||
}
|
||||
|
||||
return mComplete;
|
||||
@@ -246,6 +257,7 @@ void LedgerAcquire::done()
|
||||
if (isComplete() && !isFailed() && mLedger)
|
||||
{
|
||||
mLedger->setClosed();
|
||||
mLedger->setImmutable();
|
||||
if (mAccept)
|
||||
mLedger->setAccepted();
|
||||
theApp->getLedgerMaster().storeLedger(mLedger);
|
||||
|
||||
@@ -852,8 +852,9 @@ bool SHAMap::getPath(const uint256& index, std::vector< std::vector<unsigned cha
|
||||
}
|
||||
|
||||
void SHAMap::dropCache()
|
||||
{ // CAUTION: Changes can be lost
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
assert(mState == smsImmutable);
|
||||
|
||||
mTNByID.clear();
|
||||
if (root)
|
||||
|
||||
@@ -83,6 +83,8 @@ void SHAMap::getMissingNodes(std::vector<SHAMapNode>& nodeIDs, std::vector<uint2
|
||||
if (have_all)
|
||||
node->setFullBelow();
|
||||
}
|
||||
if (nodeIDs.empty())
|
||||
clearSynching();
|
||||
}
|
||||
|
||||
std::vector<uint256> SHAMap::getNeededHashes(int max)
|
||||
@@ -134,6 +136,8 @@ std::vector<uint256> SHAMap::getNeededHashes(int max)
|
||||
if (have_all)
|
||||
node->setFullBelow();
|
||||
}
|
||||
if (ret.empty())
|
||||
clearSynching();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user