mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Make offerDelete and fill Items more robust.
This commit is contained in:
committed by
Vinnie Falco
parent
990fb20a2a
commit
486539b3d3
@@ -1074,21 +1074,17 @@ TER LedgerEntrySet::offerDelete (SLE::ref sleOffer, uint256 const& uOfferIndex,
|
||||
bool bOwnerNode = sleOffer->isFieldPresent (sfOwnerNode); // Detect legacy dirs.
|
||||
uint64 uOwnerNode = sleOffer->getFieldU64 (sfOwnerNode);
|
||||
TER terResult = dirDelete (false, uOwnerNode, Ledger::getOwnerDirIndex (uOwnerID), uOfferIndex, false, !bOwnerNode);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
{
|
||||
ownerCountAdjust (uOwnerID, -1);
|
||||
|
||||
uint256 uDirectory = sleOffer->getFieldH256 (sfBookDirectory);
|
||||
uint64 uBookNode = sleOffer->getFieldU64 (sfBookNode);
|
||||
|
||||
// Offer delete is always hard. Always have hints.
|
||||
terResult = dirDelete (false, uBookNode, uDirectory, uOfferIndex, true, true);
|
||||
}
|
||||
// Offer delete is always hard. Always have hints.
|
||||
uint256 uDirectory = sleOffer->getFieldH256 (sfBookDirectory);
|
||||
uint64 uBookNode = sleOffer->getFieldU64 (sfBookNode);
|
||||
TER terResult2 = dirDelete ( false, uBookNode, uDirectory, uOfferIndex, true, false);
|
||||
|
||||
entryDelete (sleOffer);
|
||||
|
||||
return terResult;
|
||||
return (terResult == tesSUCCESS) ? terResult2 : terResult;
|
||||
}
|
||||
|
||||
TER LedgerEntrySet::offerDelete (uint256 const& uOfferIndex)
|
||||
|
||||
@@ -47,12 +47,21 @@ void AccountItems::fillItems (const uint160& accountID, Ledger::ref ledger)
|
||||
// VFALCO TODO rename getSLEi() to something legible.
|
||||
SLE::pointer sleCur = ledger->getSLEi (uNode);
|
||||
|
||||
AccountItem::pointer item = mOfType->makeItem (accountID, sleCur);
|
||||
|
||||
// VFALCO NOTE Under what conditions would makeItem() return nullptr?
|
||||
if (item)
|
||||
if (!sleCur)
|
||||
{
|
||||
mItems.push_back (item);
|
||||
// item in directory not in ledger
|
||||
}
|
||||
else
|
||||
{
|
||||
AccountItem::pointer item = mOfType->makeItem (accountID, sleCur);
|
||||
|
||||
// VFALCO NOTE Under what conditions would makeItem() return nullptr?
|
||||
// DJS NOTE If the item wasn't one this particular AccountItems was interested in
|
||||
// (For example, if the owner is only interested in ripple lines and this is an offer)
|
||||
if (item)
|
||||
{
|
||||
mItems.push_back (item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user