Eliminate redundant traversal logic of SHAMap:

*  Only the const_iterator interface remains.
This commit is contained in:
Howard Hinnant
2015-08-11 16:10:25 -04:00
committed by Nik Bougalis
parent 96c13f0d98
commit 12e11721f9
5 changed files with 88 additions and 224 deletions

View File

@@ -894,9 +894,8 @@ boost::optional<uint256>
Ledger::succ (uint256 const& key,
boost::optional<uint256> last) const
{
auto const item =
stateMap_->peekNextItem(key);
if (! item)
auto item = stateMap_->upper_bound(key);
if (item == stateMap_->end())
return boost::none;
if (last && item->key() >= last)
return boost::none;
@@ -1148,16 +1147,6 @@ void Ledger::visitStateItems (std::function<void (SLE::ref)> callback) const
}
}
uint256 Ledger::getNextLedgerIndex (uint256 const& hash,
boost::optional<uint256> const& last) const
{
auto const node =
stateMap_->peekNextItem(hash);
if ((! node) || (last && node->key() >= *last))
return {};
return node->key();
}
bool Ledger::walkLedger () const
{
std::vector <SHAMapMissingNode> missingNodes1;