mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
DirectoryEntryIterator fix
This commit is contained in:
@@ -30,7 +30,7 @@ bool DirectoryEntryIterator::firstEntry (LedgerEntrySet& les)
|
||||
{
|
||||
WriteLog (lsTRACE, Ledger) << "DirectoryEntryIterator::firstEntry(" << mRootIndex.GetHex() << ")";
|
||||
mEntry = 0;
|
||||
mDirIndex = mRootIndex;
|
||||
mDirNode.reset ();
|
||||
|
||||
return nextEntry (les);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ bool DirectoryEntryIterator::firstEntry (LedgerEntrySet& les)
|
||||
bool DirectoryEntryIterator::nextEntry (LedgerEntrySet& les)
|
||||
{
|
||||
|
||||
if (!mDirNode || mDirNode->getIndex() != mDirIndex)
|
||||
if (!mDirNode)
|
||||
{
|
||||
WriteLog (lsTRACE, Ledger) << "DirectoryEntryIterator::nextEntry(" << mRootIndex.GetHex() << ") need dir node";
|
||||
// Are we already at the end
|
||||
@@ -77,8 +77,11 @@ bool DirectoryEntryIterator::addJson (Json::Value& j) const
|
||||
if (mDirNode && (mEntry != 0))
|
||||
{
|
||||
j["dir_root"] = mRootIndex.GetHex();
|
||||
j["dir_index"] = mDirIndex.GetHex();
|
||||
j["dir_entry"] = static_cast<Json::UInt> (mEntry);
|
||||
|
||||
if (mDirNode)
|
||||
j["dir_index"] = mDirIndex.GetHex();
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -38,10 +38,7 @@ public:
|
||||
DirectoryEntryIterator (SLE::ref directory) : mEntry (0), mDirNode (directory)
|
||||
{
|
||||
if (mDirNode)
|
||||
{
|
||||
mDirIndex = mDirNode->getIndex();
|
||||
mRootIndex = mDirNode->getIndex();
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the SLE this iterator currently references
|
||||
@@ -69,9 +66,9 @@ public:
|
||||
return mEntryIndex;
|
||||
}
|
||||
|
||||
uint256 const& getDirectory () const
|
||||
uint256 getDirectory () const
|
||||
{
|
||||
return mDirIndex;
|
||||
return mDirNode ? mDirNode->getIndex () : uint256();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user