Change first/last/next/prev SLE functions to just return uint256's.

This commit is contained in:
JoelKatz
2012-07-17 22:14:08 -07:00
parent 93de56ae47
commit 718d1ffa48
2 changed files with 20 additions and 28 deletions

View File

@@ -167,12 +167,12 @@ public:
// next/prev function
SLE::pointer getSLE(const uint256& uHash);
SLE::pointer getFirstSLE();
SLE::pointer getLastSLE();
SLE::pointer getNextSLE(const uint256& uHash); // first node >hash
SLE::pointer getNextSLE(const uint256& uHash, const uint256& uEnd); // first node >hash, <end
SLE::pointer getPrevSLE(const uint256& uHash); // last node <hash
SLE::pointer getPrevSLE(const uint256& uHash, const uint256& uBegin); // last node <hash, >begin
uint256 getFirstLedgerID();
uint256 getLastLedgerID();
uint256 getNextLedgerID(const uint256& uHash); // first node >hash
uint256 getNextLedgerID(const uint256& uHash, const uint256& uEnd); // first node >hash, <end
uint256 getPrevLedgerID(const uint256& uHash); // last node <hash
uint256 getPrevLedgerID(const uint256& uHash, const uint256& uBegin); // last node <hash, >begin
// index calculation functions
static uint256 getAccountRootIndex(const uint160& uAccountID);

View File

@@ -53,52 +53,44 @@ SLE::pointer Ledger::getSLE(const uint256& uHash)
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
}
SLE::pointer Ledger::getFirstSLE()
uint256 Ledger::getFirstLedgerID()
{
SHAMapItem::pointer node = mAccountStateMap->peekFirstItem();
if (!node)
return SLE::pointer();
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
return node ? node->getTag() : uint256();
}
SLE::pointer Ledger::getLastSLE()
uint256 Ledger::getLastLedgerID()
{
SHAMapItem::pointer node = mAccountStateMap->peekLastItem();
if (!node)
return SLE::pointer();
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
return node ? node->getTag() : uint256();
}
SLE::pointer Ledger::getNextSLE(const uint256& uHash)
uint256 Ledger::getNextLedgerID(const uint256& uHash)
{
SHAMapItem::pointer node = mAccountStateMap->peekNextItem(uHash);
if (!node)
return SLE::pointer();
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
return node ? node->getTag() : uint256();
}
SLE::pointer Ledger::getNextSLE(const uint256& uHash, const uint256& uEnd)
uint256 Ledger::getNextLedgerID(const uint256& uHash, const uint256& uEnd)
{
SHAMapItem::pointer node = mAccountStateMap->peekNextItem(uHash);
if ((!node) || (node->getTag() > uEnd))
return SLE::pointer();
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
return uint256();
return node->getTag();
}
SLE::pointer Ledger::getPrevSLE(const uint256& uHash)
uint256 Ledger::getPrevLedgerID(const uint256& uHash)
{
SHAMapItem::pointer node = mAccountStateMap->peekPrevItem(uHash);
if (!node)
return SLE::pointer();
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
return node ? node->getTag() : uint256();
}
SLE::pointer Ledger::getPrevSLE(const uint256& uHash, const uint256& uBegin)
uint256 Ledger::getPrevLedgerID(const uint256& uHash, const uint256& uBegin)
{
SHAMapItem::pointer node = mAccountStateMap->peekNextItem(uHash);
if ((!node) || (node->getTag() < uBegin))
return SLE::pointer();
return boost::make_shared<SLE>(node->peekSerializer(), node->getTag());
return uint256();
return node->getTag();
}
SLE::pointer Ledger::getASNode(LedgerStateParms& parms, const uint256& nodeID,