mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Clean up LedgerEntrySet and TransactionEngine:
* Reduce public interfaces * Remove wrapper functions * Remove freeze timed cutover code * Return results directly instead of via ref parameters
This commit is contained in:
committed by
Tom Ritchford
parent
5ce3ed3555
commit
67c666b033
@@ -2060,12 +2060,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\app\tx\TransactionAcquire.h">
|
<ClInclude Include="..\..\src\ripple\app\tx\TransactionAcquire.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\app\tx\TransactionCheck.cpp">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
|
||||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='debug.classic|x64'">..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='release.classic|x64'">..\..\src\soci\src\core;..\..\src\sqlite;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\app\tx\TransactionEngine.cpp">
|
<ClCompile Include="..\..\src\ripple\app\tx\TransactionEngine.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||||
@@ -4518,8 +4512,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\soci\src\core\values.h">
|
<ClInclude Include="..\..\src\soci\src\core\values.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\soci\src\core\version.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\sqlite\sqlite.h">
|
<ClInclude Include="..\..\src\sqlite\sqlite.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\sqlite\sqlite.unity.c">
|
<ClCompile Include="..\..\src\sqlite\sqlite.unity.c">
|
||||||
|
|||||||
@@ -2613,9 +2613,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\app\tx\TransactionAcquire.h">
|
<ClInclude Include="..\..\src\ripple\app\tx\TransactionAcquire.h">
|
||||||
<Filter>ripple\app\tx</Filter>
|
<Filter>ripple\app\tx</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\app\tx\TransactionCheck.cpp">
|
|
||||||
<Filter>ripple\app\tx</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\ripple\app\tx\TransactionEngine.cpp">
|
<ClCompile Include="..\..\src\ripple\app\tx\TransactionEngine.cpp">
|
||||||
<Filter>ripple\app\tx</Filter>
|
<Filter>ripple\app\tx</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -5289,9 +5286,6 @@
|
|||||||
<ClInclude Include="..\..\src\soci\src\core\values.h">
|
<ClInclude Include="..\..\src\soci\src\core\values.h">
|
||||||
<Filter>soci\src\core</Filter>
|
<Filter>soci\src\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\soci\src\core\version.h">
|
|
||||||
<Filter>soci\src\core</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\sqlite\sqlite.h">
|
<ClInclude Include="..\..\src\sqlite\sqlite.h">
|
||||||
<Filter>sqlite</Filter>
|
<Filter>sqlite</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -1852,27 +1852,26 @@ int applyTransaction (TransactionEngine& engine
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool didApply;
|
auto result = engine.applyTransaction (*txn, parms);
|
||||||
TER result = engine.applyTransaction (*txn, parms, didApply);
|
|
||||||
|
|
||||||
if (didApply)
|
if (result.second)
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerConsensus)
|
WriteLog (lsDEBUG, LedgerConsensus)
|
||||||
<< "Transaction success: " << transHuman (result);
|
<< "Transaction applied: " << transHuman (result.first);
|
||||||
return LedgerConsensusImp::resultSuccess;
|
return LedgerConsensusImp::resultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTefFailure (result) || isTemMalformed (result) ||
|
if (isTefFailure (result.first) || isTemMalformed (result.first) ||
|
||||||
isTelLocal (result))
|
isTelLocal (result.first))
|
||||||
{
|
{
|
||||||
// failure
|
// failure
|
||||||
WriteLog (lsDEBUG, LedgerConsensus)
|
WriteLog (lsDEBUG, LedgerConsensus)
|
||||||
<< "Transaction failure: " << transHuman (result);
|
<< "Transaction failure: " << transHuman (result.first);
|
||||||
return LedgerConsensusImp::resultFail;
|
return LedgerConsensusImp::resultFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLog (lsDEBUG, LedgerConsensus)
|
WriteLog (lsDEBUG, LedgerConsensus)
|
||||||
<< "Transaction retry: " << transHuman (result);
|
<< "Transaction retry: " << transHuman (result.first);
|
||||||
return LedgerConsensusImp::resultRetry;
|
return LedgerConsensusImp::resultRetry;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
|||||||
@@ -261,30 +261,6 @@ Ledger::~Ledger ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ledger::enforceFreeze () const
|
|
||||||
{
|
|
||||||
|
|
||||||
// Temporarily, the freze code can run in either
|
|
||||||
// enforcing mode or non-enforcing mode. In
|
|
||||||
// non-enforcing mode, freeze flags can be
|
|
||||||
// manipulated, but freezing is not actually
|
|
||||||
// enforced. Once freeze enforcing has been
|
|
||||||
// enabled, this function can be removed
|
|
||||||
|
|
||||||
// Let freeze enforcement be tested
|
|
||||||
// If you wish to test non-enforcing mode,
|
|
||||||
// you must remove this line
|
|
||||||
if (getConfig().RUN_STANDALONE)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Freeze enforcing date is September 15, 2014
|
|
||||||
static std::uint32_t const enforceDate =
|
|
||||||
iToSeconds (boost::posix_time::ptime (
|
|
||||||
boost::gregorian::date (2014, boost::gregorian::Sep, 15)));
|
|
||||||
|
|
||||||
return mParentCloseTime >= enforceDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ledger::setImmutable ()
|
void Ledger::setImmutable ()
|
||||||
{
|
{
|
||||||
// Updates the hash and marks the ledger and its maps immutable
|
// Updates the hash and marks the ledger and its maps immutable
|
||||||
|
|||||||
@@ -181,8 +181,6 @@ public:
|
|||||||
mAccountStateMap->setLedgerSeq (mLedgerSeq);
|
mAccountStateMap->setLedgerSeq (mLedgerSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enforceFreeze () const;
|
|
||||||
|
|
||||||
// ledger signature operations
|
// ledger signature operations
|
||||||
void addRaw (Serializer & s) const;
|
void addRaw (Serializer & s) const;
|
||||||
void setRaw (Serializer & s, bool hasPrefix);
|
void setRaw (Serializer & s, bool hasPrefix);
|
||||||
|
|||||||
@@ -122,16 +122,6 @@ SLE::pointer LedgerEntrySet::entryCache (LedgerEntryType letType, uint256 const&
|
|||||||
return sleEntry;
|
return sleEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
LedgerEntryAction LedgerEntrySet::hasEntry (uint256 const& index) const
|
|
||||||
{
|
|
||||||
std::map<uint256, LedgerEntrySetEntry>::const_iterator it = mEntries.find (index);
|
|
||||||
|
|
||||||
if (it == mEntries.end ())
|
|
||||||
return taaNONE;
|
|
||||||
|
|
||||||
return it->second.mAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LedgerEntrySet::entryCache (SLE::ref sle)
|
void LedgerEntrySet::entryCache (SLE::ref sle)
|
||||||
{
|
{
|
||||||
assert (mLedger);
|
assert (mLedger);
|
||||||
@@ -1187,7 +1177,7 @@ STAmount LedgerEntrySet::accountHolds (
|
|||||||
|
|
||||||
bool LedgerEntrySet::isGlobalFrozen (Account const& issuer)
|
bool LedgerEntrySet::isGlobalFrozen (Account const& issuer)
|
||||||
{
|
{
|
||||||
if (!enforceFreeze () || isXRP (issuer))
|
if (isXRP (issuer))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SLE::pointer sle = entryCache (ltACCOUNT_ROOT, getAccountRootIndex (issuer));
|
SLE::pointer sle = entryCache (ltACCOUNT_ROOT, getAccountRootIndex (issuer));
|
||||||
@@ -1204,7 +1194,7 @@ bool LedgerEntrySet::isFrozen(
|
|||||||
Currency const& currency,
|
Currency const& currency,
|
||||||
Account const& issuer)
|
Account const& issuer)
|
||||||
{
|
{
|
||||||
if (!enforceFreeze () || isXRP (currency))
|
if (isXRP (currency))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SLE::pointer sle = entryCache (ltACCOUNT_ROOT, getAccountRootIndex (issuer));
|
SLE::pointer sle = entryCache (ltACCOUNT_ROOT, getAccountRootIndex (issuer));
|
||||||
|
|||||||
@@ -126,11 +126,6 @@ public:
|
|||||||
return mSeq;
|
return mSeq;
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionEngineParams getParams () const
|
|
||||||
{
|
|
||||||
return mParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
void bumpSeq ()
|
void bumpSeq ()
|
||||||
{
|
{
|
||||||
++mSeq;
|
++mSeq;
|
||||||
@@ -146,14 +141,9 @@ public:
|
|||||||
return mLedger;
|
return mLedger;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enforceFreeze () const
|
|
||||||
{
|
|
||||||
return mLedger->enforceFreeze ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// basic entry functions
|
// basic entry functions
|
||||||
SLE::pointer getEntry (uint256 const& index, LedgerEntryAction&);
|
SLE::pointer getEntry (uint256 const& index, LedgerEntryAction&);
|
||||||
LedgerEntryAction hasEntry (uint256 const& index) const;
|
|
||||||
void entryCache (SLE::ref); // Add this entry to the cache
|
void entryCache (SLE::ref); // Add this entry to the cache
|
||||||
void entryCreate (SLE::ref); // This entry will be created
|
void entryCreate (SLE::ref); // This entry will be created
|
||||||
void entryDelete (SLE::ref); // This entry will be deleted
|
void entryDelete (SLE::ref); // This entry will be deleted
|
||||||
|
|||||||
@@ -344,10 +344,9 @@ public:
|
|||||||
if (getApp().getHashRouter ().addSuppressionFlags (it.first.getTXID (), SF_SIGGOOD))
|
if (getApp().getHashRouter ().addSuppressionFlags (it.first.getTXID (), SF_SIGGOOD))
|
||||||
tepFlags = static_cast<TransactionEngineParams> (tepFlags | tapNO_CHECK_SIGN);
|
tepFlags = static_cast<TransactionEngineParams> (tepFlags | tapNO_CHECK_SIGN);
|
||||||
|
|
||||||
bool didApply;
|
auto ret = engine.applyTransaction (*it.second, tepFlags);
|
||||||
engine.applyTransaction (*it.second, tepFlags, didApply);
|
|
||||||
|
|
||||||
if (didApply)
|
if (ret.second)
|
||||||
++recovers;
|
++recovers;
|
||||||
|
|
||||||
// If a transaction is recovered but hasn't been relayed,
|
// If a transaction is recovered but hasn't been relayed,
|
||||||
@@ -390,7 +389,7 @@ public:
|
|||||||
ScopedLockType sl (m_mutex);
|
ScopedLockType sl (m_mutex);
|
||||||
ledger = mCurrentLedger.getMutable ();
|
ledger = mCurrentLedger.getMutable ();
|
||||||
engine.setLedger (ledger);
|
engine.setLedger (ledger);
|
||||||
result = engine.applyTransaction (*txn, params, didApply);
|
std::tie(result, didApply) = engine.applyTransaction (*txn, params);
|
||||||
}
|
}
|
||||||
if (didApply)
|
if (didApply)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1045,7 +1045,6 @@ Transaction::pointer NetworkOPsImp::processTransactionCb (
|
|||||||
if (callback)
|
if (callback)
|
||||||
callback (trans, r);
|
callback (trans, r);
|
||||||
|
|
||||||
|
|
||||||
if (r == tefFAILURE)
|
if (r == tefFAILURE)
|
||||||
throw Fault (IO_ERROR);
|
throw Fault (IO_ERROR);
|
||||||
|
|
||||||
|
|||||||
@@ -710,8 +710,7 @@ int Pathfinder::getPathsOut (
|
|||||||
|
|
||||||
int aFlags = sleAccount->getFieldU32 (sfFlags);
|
int aFlags = sleAccount->getFieldU32 (sfFlags);
|
||||||
bool const bAuthRequired = (aFlags & lsfRequireAuth) != 0;
|
bool const bAuthRequired = (aFlags & lsfRequireAuth) != 0;
|
||||||
bool const bFrozen = ((aFlags & lsfGlobalFreeze) != 0)
|
bool const bFrozen = ((aFlags & lsfGlobalFreeze) != 0);
|
||||||
&& mLedger->enforceFreeze ();
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@@ -741,7 +740,7 @@ int Pathfinder::getPathsOut (
|
|||||||
{
|
{
|
||||||
// This probably isn't a useful path out
|
// This probably isn't a useful path out
|
||||||
}
|
}
|
||||||
else if (rspEntry->getFreezePeer () && mLedger->enforceFreeze ())
|
else if (rspEntry->getFreezePeer ())
|
||||||
{
|
{
|
||||||
// Not a useful path out
|
// Not a useful path out
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ bool RippleCalc::addPathState(STPath const& path, TER& resultCode)
|
|||||||
if (pathState->status() == tesSUCCESS)
|
if (pathState->status() == tesSUCCESS)
|
||||||
pathState->checkNoRipple (uDstAccountID_, uSrcAccountID_);
|
pathState->checkNoRipple (uDstAccountID_, uSrcAccountID_);
|
||||||
|
|
||||||
if (pathState->status() == tesSUCCESS && mActiveLedger.enforceFreeze ())
|
if (pathState->status() == tesSUCCESS)
|
||||||
pathState->checkFreeze ();
|
pathState->checkFreeze ();
|
||||||
|
|
||||||
pathState->setIndex (pathStateList_.size ());
|
pathState->setIndex (pathStateList_.size ());
|
||||||
|
|||||||
@@ -128,15 +128,12 @@ void
|
|||||||
applyTransaction(Ledger::pointer const& ledger, STTx const& tx, bool check)
|
applyTransaction(Ledger::pointer const& ledger, STTx const& tx, bool check)
|
||||||
{
|
{
|
||||||
TransactionEngine engine(ledger);
|
TransactionEngine engine(ledger);
|
||||||
bool didApply = false;
|
auto r = engine.applyTransaction(tx,
|
||||||
auto r = engine.applyTransaction(tx, tapOPEN_LEDGER | (check ? tapNONE : tapNO_CHECK_SIGN),
|
tapOPEN_LEDGER | (check ? tapNONE : tapNO_CHECK_SIGN));
|
||||||
didApply);
|
if (r.first != tesSUCCESS)
|
||||||
if (r != tesSUCCESS)
|
throw std::runtime_error("r != tesSUCCESS");
|
||||||
throw std::runtime_error(
|
if (!r.second)
|
||||||
"r != tesSUCCESS");
|
throw std::runtime_error("didApply");
|
||||||
if (!didApply)
|
|
||||||
throw std::runtime_error(
|
|
||||||
"didApply");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create genesis ledger from a start amount in drops, and the public
|
// Create genesis ledger from a start amount in drops, and the public
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
|
|
||||||
uint256 const offerIndex (getOfferIndex (mTxnAccountID, uOfferSequence));
|
uint256 const offerIndex (getOfferIndex (mTxnAccountID, uOfferSequence));
|
||||||
|
|
||||||
SLE::pointer sleOffer (mEngine->entryCache (ltOFFER,
|
SLE::pointer sleOffer (mEngine->view().entryCache (ltOFFER,
|
||||||
offerIndex));
|
offerIndex));
|
||||||
|
|
||||||
if (sleOffer)
|
if (sleOffer)
|
||||||
|
|||||||
@@ -119,10 +119,10 @@ private:
|
|||||||
|
|
||||||
auto const index = getLedgerAmendmentIndex ();
|
auto const index = getLedgerAmendmentIndex ();
|
||||||
|
|
||||||
SLE::pointer amendmentObject (mEngine->entryCache (ltAMENDMENTS, index));
|
SLE::pointer amendmentObject (mEngine->view().entryCache (ltAMENDMENTS, index));
|
||||||
|
|
||||||
if (!amendmentObject)
|
if (!amendmentObject)
|
||||||
amendmentObject = mEngine->entryCreate(ltAMENDMENTS, index);
|
amendmentObject = mEngine->view().entryCreate(ltAMENDMENTS, index);
|
||||||
|
|
||||||
STVector256 amendments (amendmentObject->getFieldV256 (sfAmendments));
|
STVector256 amendments (amendmentObject->getFieldV256 (sfAmendments));
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ private:
|
|||||||
|
|
||||||
amendments.push_back (amendment);
|
amendments.push_back (amendment);
|
||||||
amendmentObject->setFieldV256 (sfAmendments, amendments);
|
amendmentObject->setFieldV256 (sfAmendments, amendments);
|
||||||
mEngine->entryModify (amendmentObject);
|
mEngine->view().entryModify (amendmentObject);
|
||||||
|
|
||||||
getApp().getAmendmentTable ().enable (amendment);
|
getApp().getAmendmentTable ().enable (amendment);
|
||||||
|
|
||||||
@@ -148,10 +148,10 @@ private:
|
|||||||
{
|
{
|
||||||
auto const index = getLedgerFeeIndex ();
|
auto const index = getLedgerFeeIndex ();
|
||||||
|
|
||||||
SLE::pointer feeObject = mEngine->entryCache (ltFEE_SETTINGS, index);
|
SLE::pointer feeObject = mEngine->view().entryCache (ltFEE_SETTINGS, index);
|
||||||
|
|
||||||
if (!feeObject)
|
if (!feeObject)
|
||||||
feeObject = mEngine->entryCreate (ltFEE_SETTINGS, index);
|
feeObject = mEngine->view().entryCreate (ltFEE_SETTINGS, index);
|
||||||
|
|
||||||
// VFALCO-FIXME this generates errors
|
// VFALCO-FIXME this generates errors
|
||||||
// m_journal.trace <<
|
// m_journal.trace <<
|
||||||
@@ -166,7 +166,7 @@ private:
|
|||||||
feeObject->setFieldU32 (
|
feeObject->setFieldU32 (
|
||||||
sfReserveIncrement, mTxn.getFieldU32 (sfReserveIncrement));
|
sfReserveIncrement, mTxn.getFieldU32 (sfReserveIncrement));
|
||||||
|
|
||||||
mEngine->entryModify (feeObject);
|
mEngine->view().entryModify (feeObject);
|
||||||
|
|
||||||
// VFALCO-FIXME this generates errors
|
// VFALCO-FIXME this generates errors
|
||||||
// m_journal.trace <<
|
// m_journal.trace <<
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ private:
|
|||||||
// Only valid for custom currencies
|
// Only valid for custom currencies
|
||||||
assert (!isXRP (issue.currency));
|
assert (!isXRP (issue.currency));
|
||||||
|
|
||||||
SLE::pointer const issuerAccount = mEngine->entryCache (
|
SLE::pointer const issuerAccount = mEngine->view().entryCache (
|
||||||
ltACCOUNT_ROOT, getAccountRootIndex (issue.account));
|
ltACCOUNT_ROOT, getAccountRootIndex (issue.account));
|
||||||
|
|
||||||
if (!issuerAccount)
|
if (!issuerAccount)
|
||||||
@@ -65,7 +65,7 @@ private:
|
|||||||
|
|
||||||
if (issuerAccount->getFieldU32 (sfFlags) & lsfRequireAuth)
|
if (issuerAccount->getFieldU32 (sfFlags) & lsfRequireAuth)
|
||||||
{
|
{
|
||||||
SLE::pointer const trustLine (mEngine->entryCache (
|
SLE::pointer const trustLine (mEngine->view().entryCache (
|
||||||
ltRIPPLE_STATE, getRippleStateIndex (
|
ltRIPPLE_STATE, getRippleStateIndex (
|
||||||
mTxnAccountID, issue.account, issue.currency)));
|
mTxnAccountID, issue.account, issue.currency)));
|
||||||
|
|
||||||
@@ -604,7 +604,7 @@ public:
|
|||||||
|
|
||||||
view.bumpSeq (); // Begin ledger variance.
|
view.bumpSeq (); // Begin ledger variance.
|
||||||
|
|
||||||
SLE::pointer sleCreator = mEngine->entryCache (
|
SLE::pointer sleCreator = mEngine->view().entryCache (
|
||||||
ltACCOUNT_ROOT, getAccountRootIndex (mTxnAccountID));
|
ltACCOUNT_ROOT, getAccountRootIndex (mTxnAccountID));
|
||||||
|
|
||||||
if (view.isGlobalFrozen (uPaysIssuerID) || view.isGlobalFrozen (uGetsIssuerID))
|
if (view.isGlobalFrozen (uPaysIssuerID) || view.isGlobalFrozen (uGetsIssuerID))
|
||||||
@@ -642,7 +642,7 @@ public:
|
|||||||
// Process a cancellation request that's passed along with an offer.
|
// Process a cancellation request that's passed along with an offer.
|
||||||
if (bHaveCancel)
|
if (bHaveCancel)
|
||||||
{
|
{
|
||||||
SLE::pointer sleCancel = mEngine->entryCache (ltOFFER,
|
SLE::pointer sleCancel = mEngine->view().entryCache (ltOFFER,
|
||||||
getOfferIndex (mTxnAccountID, uCancelSequence));
|
getOfferIndex (mTxnAccountID, uCancelSequence));
|
||||||
|
|
||||||
// It's not an error to not find the offer to cancel: it might have
|
// It's not an error to not find the offer to cancel: it might have
|
||||||
@@ -831,7 +831,7 @@ public:
|
|||||||
|
|
||||||
if (result == tesSUCCESS)
|
if (result == tesSUCCESS)
|
||||||
{
|
{
|
||||||
SLE::pointer sleOffer (mEngine->entryCreate (ltOFFER, offer_index));
|
SLE::pointer sleOffer (mEngine->view().entryCreate (ltOFFER, offer_index));
|
||||||
|
|
||||||
sleOffer->setFieldAccount (sfAccount, mTxnAccountID);
|
sleOffer->setFieldAccount (sfAccount, mTxnAccountID);
|
||||||
sleOffer->setFieldU32 (sfSequence, uSequence);
|
sleOffer->setFieldU32 (sfSequence, uSequence);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SLE::pointer sleTicket = mEngine->entryCreate (ltTICKET,
|
SLE::pointer sleTicket = mEngine->view().entryCreate (ltTICKET,
|
||||||
getTicketIndex (mTxnAccountID, mTxn.getSequence ()));
|
getTicketIndex (mTxnAccountID, mTxn.getSequence ()));
|
||||||
|
|
||||||
sleTicket->setFieldAccount (sfAccount, mTxnAccountID);
|
sleTicket->setFieldAccount (sfAccount, mTxnAccountID);
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
{
|
{
|
||||||
Account const target_account (mTxn.getFieldAccount160 (sfTarget));
|
Account const target_account (mTxn.getFieldAccount160 (sfTarget));
|
||||||
|
|
||||||
SLE::pointer sleTarget = mEngine->entryCache (ltACCOUNT_ROOT,
|
SLE::pointer sleTarget = mEngine->view().entryCache (ltACCOUNT_ROOT,
|
||||||
getAccountRootIndex (target_account));
|
getAccountRootIndex (target_account));
|
||||||
|
|
||||||
// Destination account does not exist.
|
// Destination account does not exist.
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public:
|
|||||||
|
|
||||||
// Open a ledger for editing.
|
// Open a ledger for editing.
|
||||||
auto const index = getAccountRootIndex (uDstAccountID);
|
auto const index = getAccountRootIndex (uDstAccountID);
|
||||||
SLE::pointer sleDst (mEngine->entryCache (ltACCOUNT_ROOT, index));
|
SLE::pointer sleDst (mEngine->view().entryCache (ltACCOUNT_ROOT, index));
|
||||||
|
|
||||||
if (!sleDst)
|
if (!sleDst)
|
||||||
{
|
{
|
||||||
@@ -234,7 +234,7 @@ public:
|
|||||||
|
|
||||||
// Create the account.
|
// Create the account.
|
||||||
auto const newIndex = getAccountRootIndex (uDstAccountID);
|
auto const newIndex = getAccountRootIndex (uDstAccountID);
|
||||||
sleDst = mEngine->entryCreate (ltACCOUNT_ROOT, newIndex);
|
sleDst = mEngine->view().entryCreate (ltACCOUNT_ROOT, newIndex);
|
||||||
sleDst->setFieldAccount (sfAccount, uDstAccountID);
|
sleDst->setFieldAccount (sfAccount, uDstAccountID);
|
||||||
sleDst->setFieldU32 (sfSequence, 1);
|
sleDst->setFieldU32 (sfSequence, 1);
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ public:
|
|||||||
// Tell the engine that we are intending to change the the destination
|
// Tell the engine that we are intending to change the the destination
|
||||||
// account. The source account gets always charged a fee so it's always
|
// account. The source account gets always charged a fee so it's always
|
||||||
// marked as modified.
|
// marked as modified.
|
||||||
mEngine->entryModify (sleDst);
|
mEngine->view().entryModify (sleDst);
|
||||||
}
|
}
|
||||||
|
|
||||||
TER terResult;
|
TER terResult;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
// lines exist now, why not remove this code and simply
|
// lines exist now, why not remove this code and simply
|
||||||
// return an error?
|
// return an error?
|
||||||
SLE::pointer selDelete (
|
SLE::pointer selDelete (
|
||||||
mEngine->entryCache (ltRIPPLE_STATE,
|
mEngine->view().entryCache (ltRIPPLE_STATE,
|
||||||
getRippleStateIndex (
|
getRippleStateIndex (
|
||||||
mTxnAccountID, uDstAccountID, currency)));
|
mTxnAccountID, uDstAccountID, currency)));
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SLE::pointer sleDst (mEngine->entryCache (
|
SLE::pointer sleDst (mEngine->view().entryCache (
|
||||||
ltACCOUNT_ROOT, getAccountRootIndex (uDstAccountID)));
|
ltACCOUNT_ROOT, getAccountRootIndex (uDstAccountID)));
|
||||||
|
|
||||||
if (!sleDst)
|
if (!sleDst)
|
||||||
@@ -186,7 +186,7 @@ public:
|
|||||||
STAmount saLimitAllow = saLimitAmount;
|
STAmount saLimitAllow = saLimitAmount;
|
||||||
saLimitAllow.setIssuer (mTxnAccountID);
|
saLimitAllow.setIssuer (mTxnAccountID);
|
||||||
|
|
||||||
SLE::pointer sleRippleState (mEngine->entryCache (ltRIPPLE_STATE,
|
SLE::pointer sleRippleState (mEngine->view().entryCache (ltRIPPLE_STATE,
|
||||||
getRippleStateIndex (mTxnAccountID, uDstAccountID, currency)));
|
getRippleStateIndex (mTxnAccountID, uDstAccountID, currency)));
|
||||||
|
|
||||||
if (sleRippleState)
|
if (sleRippleState)
|
||||||
@@ -391,7 +391,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mEngine->entryModify (sleRippleState);
|
mEngine->view().entryModify (sleRippleState);
|
||||||
|
|
||||||
m_journal.trace << "Modify ripple line";
|
m_journal.trace << "Modify ripple line";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ TER Transactor::apply ()
|
|||||||
return terResult;
|
return terResult;
|
||||||
|
|
||||||
// Find source account
|
// Find source account
|
||||||
mTxnAccount = mEngine->entryCache (ltACCOUNT_ROOT,
|
mTxnAccount = mEngine->view().entryCache (ltACCOUNT_ROOT,
|
||||||
getAccountRootIndex (mTxnAccountID));
|
getAccountRootIndex (mTxnAccountID));
|
||||||
|
|
||||||
calculateFee ();
|
calculateFee ();
|
||||||
@@ -303,7 +303,7 @@ TER Transactor::apply ()
|
|||||||
if (terResult != tesSUCCESS) return (terResult);
|
if (terResult != tesSUCCESS) return (terResult);
|
||||||
|
|
||||||
if (mTxnAccount)
|
if (mTxnAccount)
|
||||||
mEngine->entryModify (mTxnAccount);
|
mEngine->view().entryModify (mTxnAccount);
|
||||||
|
|
||||||
return doApply ();
|
return doApply ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,9 +156,7 @@ public:
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TransactionEngineParams parms = tapOPEN_LEDGER;
|
engine.applyTransaction (*it.second, tapOPEN_LEDGER);
|
||||||
bool didApply;
|
|
||||||
engine.applyTransaction (*it.second, parms, didApply);
|
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
|
||||||
#include <ripple/app/tx/TransactionEngine.h>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
// VFALCO TODO move this into TransactionEngine.cpp
|
|
||||||
|
|
||||||
// Double check a transaction's metadata to make sure no system invariants were broken
|
|
||||||
|
|
||||||
bool TransactionEngine::checkInvariants (TER result, const STTx& txn, TransactionEngineParams params)
|
|
||||||
{
|
|
||||||
// VFALCO I deleted a bunch of code that was wrapped in #if 0.
|
|
||||||
// If you need it, check the commit log.
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
@@ -80,15 +80,25 @@ void TransactionEngine::txnWrite ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TER TransactionEngine::applyTransaction (
|
std::pair<TER, bool>
|
||||||
|
TransactionEngine::applyTransaction (
|
||||||
STTx const& txn,
|
STTx const& txn,
|
||||||
TransactionEngineParams params,
|
TransactionEngineParams params)
|
||||||
bool& didApply)
|
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, TransactionEngine) << "applyTransaction>";
|
|
||||||
didApply = false;
|
|
||||||
assert (mLedger);
|
assert (mLedger);
|
||||||
mNodes.init (mLedger, txn.getTransactionID (), mLedger->getLedgerSeq (), params);
|
|
||||||
|
WriteLog (lsTRACE, TransactionEngine) << "applyTransaction>";
|
||||||
|
|
||||||
|
uint256 const& txID = txn.getTransactionID ();
|
||||||
|
|
||||||
|
if (!txID)
|
||||||
|
{
|
||||||
|
WriteLog (lsWARNING, TransactionEngine) <<
|
||||||
|
"applyTransaction: invalid transaction id";
|
||||||
|
return std::make_pair(temINVALID_FLAG, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mNodes.init (mLedger, txID, mLedger->getLedgerSeq (), params);
|
||||||
|
|
||||||
#ifdef BEAST_DEBUG
|
#ifdef BEAST_DEBUG
|
||||||
if (1)
|
if (1)
|
||||||
@@ -109,22 +119,13 @@ TER TransactionEngine::applyTransaction (
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint256 const& txID = txn.getTransactionID ();
|
|
||||||
|
|
||||||
if (!txID)
|
|
||||||
{
|
|
||||||
WriteLog (lsWARNING, TransactionEngine) <<
|
|
||||||
"applyTransaction: invalid transaction id";
|
|
||||||
return temINVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
TER terResult = Transactor::transact (txn, params, this);
|
TER terResult = Transactor::transact (txn, params, this);
|
||||||
|
|
||||||
if (terResult == temUNKNOWN)
|
if (terResult == temUNKNOWN)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, TransactionEngine) <<
|
WriteLog (lsWARNING, TransactionEngine) <<
|
||||||
"applyTransaction: Invalid transaction: unknown transaction type";
|
"applyTransaction: Invalid transaction: unknown transaction type";
|
||||||
return temUNKNOWN;
|
return std::make_pair(temUNKNOWN, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldLog (lsDEBUG, TransactionEngine))
|
if (ShouldLog (lsDEBUG, TransactionEngine))
|
||||||
@@ -140,15 +141,16 @@ TER TransactionEngine::applyTransaction (
|
|||||||
" : " << strHuman;
|
" : " << strHuman;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTesSuccess (terResult))
|
bool didApply = isTesSuccess (terResult);
|
||||||
didApply = true;
|
|
||||||
else if (isTecClaim (terResult) && !(params & tapRETRY))
|
if (isTecClaim (terResult) && !(params & tapRETRY))
|
||||||
{
|
{
|
||||||
// only claim the transaction fee
|
// only claim the transaction fee
|
||||||
WriteLog (lsDEBUG, TransactionEngine) << "Reprocessing to only claim fee";
|
WriteLog (lsDEBUG, TransactionEngine) <<
|
||||||
|
"Reprocessing tx " << txID << " to only claim fee";
|
||||||
mNodes.clear ();
|
mNodes.clear ();
|
||||||
|
|
||||||
SLE::pointer txnAcct = entryCache (ltACCOUNT_ROOT,
|
SLE::pointer txnAcct = mNodes.entryCache (ltACCOUNT_ROOT,
|
||||||
getAccountRootIndex (txn.getSourceAccount ()));
|
getAccountRootIndex (txn.getSourceAccount ()));
|
||||||
|
|
||||||
if (!txnAcct)
|
if (!txnAcct)
|
||||||
@@ -182,18 +184,18 @@ TER TransactionEngine::applyTransaction (
|
|||||||
fee = balance;
|
fee = balance;
|
||||||
txnAcct->setFieldAmount (sfBalance, balance - fee);
|
txnAcct->setFieldAmount (sfBalance, balance - fee);
|
||||||
txnAcct->setFieldU32 (sfSequence, t_seq + 1);
|
txnAcct->setFieldU32 (sfSequence, t_seq + 1);
|
||||||
entryModify (txnAcct);
|
mNodes.entryModify (txnAcct);
|
||||||
didApply = true;
|
didApply = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!didApply)
|
||||||
WriteLog (lsDEBUG, TransactionEngine) << "Not applying transaction " << txID;
|
|
||||||
|
|
||||||
if (didApply)
|
|
||||||
{
|
{
|
||||||
if (!checkInvariants (terResult, txn, params))
|
WriteLog (lsDEBUG, TransactionEngine) << "Not applying transaction " << txID;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (didApply && !checkInvariants (terResult, txn, params))
|
||||||
{
|
{
|
||||||
WriteLog (lsFATAL, TransactionEngine) <<
|
WriteLog (lsFATAL, TransactionEngine) <<
|
||||||
"Transaction violates invariants";
|
"Transaction violates invariants";
|
||||||
@@ -206,7 +208,8 @@ TER TransactionEngine::applyTransaction (
|
|||||||
didApply = false;
|
didApply = false;
|
||||||
terResult = tefINTERNAL;
|
terResult = tefINTERNAL;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (didApply)
|
||||||
{
|
{
|
||||||
// Transaction succeeded fully or (retries are not allowed and the
|
// Transaction succeeded fully or (retries are not allowed and the
|
||||||
// transaction could claim a fee)
|
// transaction could claim a fee)
|
||||||
@@ -223,7 +226,7 @@ TER TransactionEngine::applyTransaction (
|
|||||||
if (!mLedger->addTransaction (txID, s))
|
if (!mLedger->addTransaction (txID, s))
|
||||||
{
|
{
|
||||||
WriteLog (lsFATAL, TransactionEngine) <<
|
WriteLog (lsFATAL, TransactionEngine) <<
|
||||||
"Tried to add transaction to open ledger that already had it";
|
"Duplicate transaction applied";
|
||||||
assert (false);
|
assert (false);
|
||||||
throw std::runtime_error ("Duplicate transaction applied");
|
throw std::runtime_error ("Duplicate transaction applied");
|
||||||
}
|
}
|
||||||
@@ -233,7 +236,7 @@ TER TransactionEngine::applyTransaction (
|
|||||||
if (!mLedger->addTransaction (txID, s, m))
|
if (!mLedger->addTransaction (txID, s, m))
|
||||||
{
|
{
|
||||||
WriteLog (lsFATAL, TransactionEngine) <<
|
WriteLog (lsFATAL, TransactionEngine) <<
|
||||||
"Tried to add transaction to ledger that already had it";
|
"Duplicate transaction applied to closed ledger";
|
||||||
assert (false);
|
assert (false);
|
||||||
throw std::runtime_error ("Duplicate transaction applied to closed ledger");
|
throw std::runtime_error ("Duplicate transaction applied to closed ledger");
|
||||||
}
|
}
|
||||||
@@ -243,9 +246,7 @@ TER TransactionEngine::applyTransaction (
|
|||||||
mLedger->destroyCoins (saPaid.getNValue ());
|
mLedger->destroyCoins (saPaid.getNValue ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mTxnAccount.reset ();
|
|
||||||
mNodes.clear ();
|
mNodes.clear ();
|
||||||
|
|
||||||
if (!(params & tapOPEN_LEDGER) && isTemMalformed (terResult))
|
if (!(params & tapOPEN_LEDGER) && isTemMalformed (terResult))
|
||||||
@@ -253,7 +254,19 @@ TER TransactionEngine::applyTransaction (
|
|||||||
// XXX Malformed or failed transaction in closed ledger must bow out.
|
// XXX Malformed or failed transaction in closed ledger must bow out.
|
||||||
}
|
}
|
||||||
|
|
||||||
return terResult;
|
return { terResult, didApply };
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TransactionEngine::checkInvariants (
|
||||||
|
TER result,
|
||||||
|
STTx const& txn,
|
||||||
|
TransactionEngineParams params)
|
||||||
|
{
|
||||||
|
// VFALCO I deleted a bunch of code that was wrapped in #if 0.
|
||||||
|
// If you need it, check the commit log.
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <ripple/app/ledger/Ledger.h>
|
#include <ripple/app/ledger/Ledger.h>
|
||||||
#include <ripple/app/ledger/LedgerEntrySet.h>
|
#include <ripple/app/ledger/LedgerEntrySet.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -39,67 +40,45 @@ public:
|
|||||||
private:
|
private:
|
||||||
LedgerEntrySet mNodes;
|
LedgerEntrySet mNodes;
|
||||||
|
|
||||||
TER setAuthorized (const STTx & txn, bool bMustSetGenerator);
|
void txnWrite ();
|
||||||
TER checkSig (const STTx & txn);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ledger::pointer mLedger;
|
Ledger::pointer mLedger;
|
||||||
int mTxnSeq;
|
int mTxnSeq = 0;
|
||||||
|
|
||||||
Account mTxnAccountID;
|
|
||||||
SLE::pointer mTxnAccount;
|
|
||||||
|
|
||||||
void txnWrite ();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr<TransactionEngine> pointer;
|
TransactionEngine () = default;
|
||||||
|
|
||||||
TransactionEngine () : mTxnSeq (0)
|
TransactionEngine (Ledger::ref ledger)
|
||||||
{
|
: mLedger (ledger)
|
||||||
;
|
|
||||||
}
|
|
||||||
TransactionEngine (Ledger::ref ledger) : mLedger (ledger), mTxnSeq (0)
|
|
||||||
{
|
{
|
||||||
assert (mLedger);
|
assert (mLedger);
|
||||||
}
|
}
|
||||||
|
|
||||||
LedgerEntrySet& view ()
|
LedgerEntrySet&
|
||||||
|
view ()
|
||||||
{
|
{
|
||||||
return mNodes;
|
return mNodes;
|
||||||
}
|
}
|
||||||
Ledger::ref getLedger ()
|
|
||||||
|
Ledger::ref
|
||||||
|
getLedger ()
|
||||||
{
|
{
|
||||||
return mLedger;
|
return mLedger;
|
||||||
}
|
}
|
||||||
void setLedger (Ledger::ref ledger)
|
|
||||||
|
void
|
||||||
|
setLedger (Ledger::ref ledger)
|
||||||
{
|
{
|
||||||
assert (ledger);
|
assert (ledger);
|
||||||
mLedger = ledger;
|
mLedger = ledger;
|
||||||
}
|
}
|
||||||
|
|
||||||
// VFALCO TODO Remove these pointless wrappers
|
std::pair<TER, bool>
|
||||||
SLE::pointer entryCreate (LedgerEntryType type, uint256 const& index)
|
applyTransaction (STTx const&, TransactionEngineParams);
|
||||||
{
|
|
||||||
return mNodes.entryCreate (type, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
SLE::pointer entryCache (LedgerEntryType type, uint256 const& index)
|
bool
|
||||||
{
|
checkInvariants (TER result, STTx const& txn, TransactionEngineParams params);
|
||||||
return mNodes.entryCache (type, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void entryDelete (SLE::ref sleEntry)
|
|
||||||
{
|
|
||||||
mNodes.entryDelete (sleEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
void entryModify (SLE::ref sleEntry)
|
|
||||||
{
|
|
||||||
mNodes.entryModify (sleEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
TER applyTransaction (const STTx&, TransactionEngineParams, bool & didApply);
|
|
||||||
bool checkInvariants (TER result, const STTx & txn, TransactionEngineParams params);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline TransactionEngineParams operator| (const TransactionEngineParams& l1, const TransactionEngineParams& l2)
|
inline TransactionEngineParams operator| (const TransactionEngineParams& l1, const TransactionEngineParams& l2)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ CreateOffer::checkAcceptAsset(IssueRef issue) const
|
|||||||
/* Only valid for custom currencies */
|
/* Only valid for custom currencies */
|
||||||
assert (!isXRP (issue.currency));
|
assert (!isXRP (issue.currency));
|
||||||
|
|
||||||
SLE::pointer const issuerAccount = mEngine->entryCache (
|
SLE::pointer const issuerAccount = mEngine->view().entryCache (
|
||||||
ltACCOUNT_ROOT, getAccountRootIndex (issue.account));
|
ltACCOUNT_ROOT, getAccountRootIndex (issue.account));
|
||||||
|
|
||||||
if (!issuerAccount)
|
if (!issuerAccount)
|
||||||
@@ -55,7 +55,7 @@ CreateOffer::checkAcceptAsset(IssueRef issue) const
|
|||||||
|
|
||||||
if (issuerAccount->getFieldU32 (sfFlags) & lsfRequireAuth)
|
if (issuerAccount->getFieldU32 (sfFlags) & lsfRequireAuth)
|
||||||
{
|
{
|
||||||
SLE::pointer const trustLine (mEngine->entryCache (
|
SLE::pointer const trustLine (mEngine->view().entryCache (
|
||||||
ltRIPPLE_STATE, getRippleStateIndex (
|
ltRIPPLE_STATE, getRippleStateIndex (
|
||||||
mTxnAccountID, issue.account, issue.currency)));
|
mTxnAccountID, issue.account, issue.currency)));
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ CreateOffer::doApply()
|
|||||||
|
|
||||||
view.bumpSeq (); // Begin ledger variance.
|
view.bumpSeq (); // Begin ledger variance.
|
||||||
|
|
||||||
SLE::pointer sleCreator = mEngine->entryCache (
|
SLE::pointer sleCreator = mEngine->view().entryCache (
|
||||||
ltACCOUNT_ROOT, getAccountRootIndex (mTxnAccountID));
|
ltACCOUNT_ROOT, getAccountRootIndex (mTxnAccountID));
|
||||||
|
|
||||||
if (uTxFlags & tfOfferCreateMask)
|
if (uTxFlags & tfOfferCreateMask)
|
||||||
@@ -336,7 +336,7 @@ CreateOffer::doApply()
|
|||||||
{
|
{
|
||||||
uint256 const uCancelIndex (
|
uint256 const uCancelIndex (
|
||||||
getOfferIndex (mTxnAccountID, uCancelSequence));
|
getOfferIndex (mTxnAccountID, uCancelSequence));
|
||||||
SLE::pointer sleCancel = mEngine->entryCache (ltOFFER, uCancelIndex);
|
SLE::pointer sleCancel = mEngine->view().entryCache (ltOFFER, uCancelIndex);
|
||||||
|
|
||||||
// It's not an error to not find the offer to cancel: it might have
|
// It's not an error to not find the offer to cancel: it might have
|
||||||
// been consumed or removed as we are processing.
|
// been consumed or removed as we are processing.
|
||||||
@@ -571,7 +571,7 @@ CreateOffer::doApply()
|
|||||||
saTakerGets.getHumanCurrency ();
|
saTakerGets.getHumanCurrency ();
|
||||||
}
|
}
|
||||||
|
|
||||||
SLE::pointer sleOffer (mEngine->entryCreate (ltOFFER, uLedgerIndex));
|
SLE::pointer sleOffer (mEngine->view().entryCreate (ltOFFER, uLedgerIndex));
|
||||||
|
|
||||||
sleOffer->setFieldAccount (sfAccount, mTxnAccountID);
|
sleOffer->setFieldAccount (sfAccount, mTxnAccountID);
|
||||||
sleOffer->setFieldU32 (sfSequence, uSequence);
|
sleOffer->setFieldU32 (sfSequence, uSequence);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include <ripple/app/paths/RippleState.cpp>
|
#include <ripple/app/paths/RippleState.cpp>
|
||||||
#include <ripple/app/peers/UniqueNodeList.cpp>
|
#include <ripple/app/peers/UniqueNodeList.cpp>
|
||||||
#include <ripple/app/transactors/Transactor.h>
|
#include <ripple/app/transactors/Transactor.h>
|
||||||
#include <ripple/app/tx/TransactionCheck.cpp>
|
|
||||||
#include <ripple/app/tx/TransactionMaster.cpp>
|
#include <ripple/app/tx/TransactionMaster.cpp>
|
||||||
#include <ripple/app/tx/Transaction.cpp>
|
#include <ripple/app/tx/Transaction.cpp>
|
||||||
#include <ripple/app/tx/TransactionEngine.cpp>
|
#include <ripple/app/tx/TransactionEngine.cpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user