Refactor LedgerEntrySet:

* Remove duplicate:
    This changes behavior to fix an apparent bug. The
    copy will now correctly inherit mParams instead
    of reverting to tapNONE

* Tidy up LedgerEntrySet declarations
* Tidy up TransactionEngine
* Tidy PathCursor declarations
* Add LedgerEntrySet::apply
* Add LedgerEntrySet ctor
* Add Keylet, keylet namespace
* Add defaulted copy members
* Use optional in TransactionEngine
* Use optional<LedgerEntrySet> in PathState
* Return shared_ptr in Ledger::fetch
* Don't call entryCache with zero
* Deprecate invalidate
* Remove default constructor
* Remove unused container API
* Remove CountedObject base class
* Remove insert, clear
* Remove entryCreate overload
* Remove unused and tidy up STLedgerEntry
* Make getEntry private and tidy
* Replace members with adjustOwnerCount free function
* Replace accountFunds with funds free function
This commit is contained in:
Vinnie Falco
2015-06-09 10:37:13 -04:00
committed by Nik Bougalis
parent aead038215
commit d21171b21e
32 changed files with 746 additions and 526 deletions

View File

@@ -984,20 +984,19 @@ Ledger::insert (SLE const& sle)
assert(success);
}
boost::optional<SLE>
std::shared_ptr<SLE>
Ledger::fetch (uint256 const& key,
boost::optional<LedgerEntryType> type) const
{
auto const item =
mAccountStateMap->peekItem(key);
if (! item)
return boost::none;
boost::optional<SLE> result;
result.emplace(item->peekSerializer(),
item->getTag());
if (type && result->getType() != type)
return {};
return result;
return nullptr;
auto const sle = std::make_shared<SLE>(
item->peekSerializer(), item->getTag());
if (type && sle->getType() != type)
return nullptr;
return sle;
}
void
@@ -1171,7 +1170,8 @@ void Ledger::updateSkipList ()
bool created;
if (! sle)
{
sle.emplace(ltLEDGER_HASHES, key);
sle = std::make_shared<SLE>(
ltLEDGER_HASHES, key);
created = true;
}
else
@@ -1198,7 +1198,8 @@ void Ledger::updateSkipList ()
bool created;
if (! sle)
{
sle.emplace(ltLEDGER_HASHES, key);
sle = std::make_shared<SLE>(
ltLEDGER_HASHES, key);
created = true;
}
else