Pass a bool to the describer telling it if the directory is new.

This commit is contained in:
JoelKatz
2013-09-16 18:12:21 -07:00
parent b45b029ba7
commit 74b2d1f3fa
5 changed files with 16 additions and 15 deletions

View File

@@ -1873,12 +1873,12 @@ std::set<uint32> Ledger::getPendingSaves()
return sPendingSaves;
}
void Ledger::ownerDirDescriber (SLE::ref sle, const uint160& owner)
void Ledger::ownerDirDescriber (SLE::ref sle, bool, const uint160& owner)
{
sle->setFieldAccount (sfOwner, owner);
}
void Ledger::qualityDirDescriber (SLE::ref sle,
void Ledger::qualityDirDescriber (SLE::ref sle, bool,
const uint160& uTakerPaysCurrency, const uint160& uTakerPaysIssuer,
const uint160& uTakerGetsCurrency, const uint160& uTakerGetsIssuer,
const uint64& uRate)

View File

@@ -364,7 +364,7 @@ public:
// Given a directory root and and index compute the index of a node.
static uint256 getDirNodeIndex (uint256 const & uDirRoot, const uint64 uNodeIndex = 0);
static void ownerDirDescriber (SLE::ref, const uint160 & owner);
static void ownerDirDescriber (SLE::ref, bool, const uint160 & owner);
// Return a node: root or normal
SLE::pointer getDirNode (uint256 const & uNodeIndex);
@@ -376,7 +376,7 @@ public:
static uint256 getQualityIndex (uint256 const & uBase, const uint64 uNodeDir = 0);
static uint256 getQualityNext (uint256 const & uBase);
static uint64 getQuality (uint256 const & uBase);
static void qualityDirDescriber (SLE::ref,
static void qualityDirDescriber (SLE::ref, bool,
const uint160 & uTakerPaysCurrency, const uint160 & uTakerPaysIssuer,
const uint160 & uTakerGetsCurrency, const uint160 & uTakerGetsIssuer,
const uint64 & uRate);

View File

@@ -628,7 +628,7 @@ TER LedgerEntrySet::dirAdd (
uint64& uNodeDir,
uint256 const& uRootIndex,
uint256 const& uLedgerIndex,
FUNCTION_TYPE<void (SLE::ref)> fDescriber)
FUNCTION_TYPE<void (SLE::ref, bool)> fDescriber)
{
WriteLog (lsTRACE, LedgerEntrySet) << boost::str (boost::format ("dirAdd: uRootIndex=%s uLedgerIndex=%s")
% uRootIndex.ToString ()
@@ -643,7 +643,7 @@ TER LedgerEntrySet::dirAdd (
// No root, make it.
sleRoot = entryCreate (ltDIR_NODE, uRootIndex);
sleRoot->setFieldH256 (sfRootIndex, uRootIndex);
fDescriber (sleRoot);
fDescriber (sleRoot, true);
sleNode = sleRoot;
uNodeDir = 0;
@@ -694,7 +694,7 @@ TER LedgerEntrySet::dirAdd (
if (uNodeDir != 1)
sleNode->setFieldU64 (sfIndexPrevious, uNodeDir - 1);
fDescriber (sleNode);
fDescriber (sleNode, false);
svIndexes = STVector256 ();
}
@@ -1350,7 +1350,7 @@ TER LedgerEntrySet::trustCreate (
uLowNode,
Ledger::getOwnerDirIndex (uLowAccountID),
sleRippleState->getIndex (),
BIND_TYPE (&Ledger::ownerDirDescriber, P_1, uLowAccountID));
BIND_TYPE (&Ledger::ownerDirDescriber, P_1, P_2, uLowAccountID));
if (tesSUCCESS == terResult)
{
@@ -1358,7 +1358,7 @@ TER LedgerEntrySet::trustCreate (
uHighNode,
Ledger::getOwnerDirIndex (uHighAccountID),
sleRippleState->getIndex (),
BIND_TYPE (&Ledger::ownerDirDescriber, P_1, uHighAccountID));
BIND_TYPE (&Ledger::ownerDirDescriber, P_1, P_2, uHighAccountID));
}
if (tesSUCCESS == terResult)

View File

@@ -147,7 +147,7 @@ public:
uint64 & uNodeDir, // Node of entry.
uint256 const & uRootIndex,
uint256 const & uLedgerIndex,
FUNCTION_TYPE<void (SLE::ref)> fDescriber);
FUNCTION_TYPE<void (SLE::ref, bool)> fDescriber);
TER dirDelete (
const bool bKeepRoot,

View File

@@ -637,7 +637,7 @@ TER OfferCreateTransactor::doApply ()
// Add offer to owner's directory.
terResult = lesActive.dirAdd (uOwnerNode, Ledger::getOwnerDirIndex (mTxnAccountID), uLedgerIndex,
BIND_TYPE (&Ledger::ownerDirDescriber, P_1, mTxnAccountID));
BIND_TYPE (&Ledger::ownerDirDescriber, P_1, P_2, mTxnAccountID));
if (tesSUCCESS == terResult)
@@ -657,7 +657,8 @@ TER OfferCreateTransactor::doApply ()
// Add offer to order book.
terResult = lesActive.dirAdd (uBookNode, uDirectory, uLedgerIndex,
BIND_TYPE (&Ledger::qualityDirDescriber, P_1, saTakerPays.getCurrency (), uPaysIssuerID,
BIND_TYPE (&Ledger::qualityDirDescriber, P_1, P_2,
saTakerPays.getCurrency (), uPaysIssuerID,
saTakerGets.getCurrency (), uGetsIssuerID, uRate));
}