mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 18:45:55 +00:00
Refactor MetaView (RIPD-954):
Obsolete functionality is removed. DeferredCredits is moved to a new class PaymentView, and used in RippleCalc.
This commit is contained in:
@@ -1647,6 +1647,12 @@
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\impl\PaymentView.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\impl\PaymentView.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\Node.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
@@ -1751,8 +1757,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\tx\impl\PaymentView.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\tx\impl\SetAccount.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
@@ -2261,7 +2265,7 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\ledger\impl\ViewAPI.cpp">
|
||||
<ClCompile Include="..\..\src\ripple\ledger\impl\View.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -2269,8 +2273,6 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\ledger\View.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\ledger\ViewAPI.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\ledger\ViewAPIBasics.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\net\HTTPClient.h">
|
||||
|
||||
@@ -271,6 +271,9 @@
|
||||
<Filter Include="ripple\app\paths\cursor">
|
||||
<UniqueIdentifier>{9AD8D049-10A8-704C-D51A-FAD55B1F235F}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ripple\app\paths\impl">
|
||||
<UniqueIdentifier>{38932157-7DA1-A9CC-CABC-2A3D9CACF188}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ripple\app\tests">
|
||||
<UniqueIdentifier>{2E791662-6ED0-D1E1-03A4-0CB35473EC56}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -2373,6 +2376,12 @@
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h">
|
||||
<Filter>ripple\app\paths</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\impl\PaymentView.cpp">
|
||||
<Filter>ripple\app\paths\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\impl\PaymentView.h">
|
||||
<Filter>ripple\app\paths\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\Node.cpp">
|
||||
<Filter>ripple\app\paths</Filter>
|
||||
</ClCompile>
|
||||
@@ -2472,9 +2481,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\app\tx\impl\Payment.cpp">
|
||||
<Filter>ripple\app\tx\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\tx\impl\PaymentView.h">
|
||||
<Filter>ripple\app\tx\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\tx\impl\SetAccount.cpp">
|
||||
<Filter>ripple\app\tx\impl</Filter>
|
||||
</ClCompile>
|
||||
@@ -2964,7 +2970,7 @@
|
||||
<ClCompile Include="..\..\src\ripple\ledger\impl\DeferredCredits.cpp">
|
||||
<Filter>ripple\ledger\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ripple\ledger\impl\ViewAPI.cpp">
|
||||
<ClCompile Include="..\..\src\ripple\ledger\impl\View.cpp">
|
||||
<Filter>ripple\ledger\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\ledger\SLECache.h">
|
||||
@@ -2973,9 +2979,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\ledger\View.h">
|
||||
<Filter>ripple\ledger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\ledger\ViewAPI.h">
|
||||
<Filter>ripple\ledger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\ledger\ViewAPIBasics.h">
|
||||
<Filter>ripple\ledger</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/ledger/AcceptedLedgerTx.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <ripple/protocol/types.h>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_LEDGER_METAVIEW_H_INCLUDED
|
||||
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/ledger/DeferredCredits.h>
|
||||
#include <ripple/basics/CountedObject.h>
|
||||
#include <ripple/ledger/ViewAPIBasics.h>
|
||||
#include <ripple/protocol/Keylet.h>
|
||||
@@ -65,9 +64,6 @@ enum TransactionEngineParams
|
||||
class MetaView : public View
|
||||
{
|
||||
private:
|
||||
using Mods =
|
||||
hash_map<uint256, SLE::pointer>;
|
||||
|
||||
enum Action
|
||||
{
|
||||
taaCACHED, // Unmodified.
|
||||
@@ -76,30 +72,18 @@ private:
|
||||
taaCREATE, // Newly created.
|
||||
};
|
||||
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
int mSeq;
|
||||
Action mAction;
|
||||
std::shared_ptr<SLE> mEntry;
|
||||
using Item = std::pair<Action,
|
||||
std::shared_ptr<SLE>>;
|
||||
|
||||
Item (SLE::ref e, Action a, int s)
|
||||
: mSeq (s)
|
||||
, mAction (a)
|
||||
, mEntry (e)
|
||||
{
|
||||
}
|
||||
};
|
||||
using Mods = hash_map<uint256,
|
||||
std::shared_ptr<SLE>>;
|
||||
|
||||
using list_type = std::map<uint256, Item>;
|
||||
|
||||
BasicView* parent_;
|
||||
MetaView* mParent_ = NULL;
|
||||
list_type items_;
|
||||
boost::optional<DeferredCredits> mDeferredCredits;
|
||||
TransactionMetaSet mSet;
|
||||
TransactionEngineParams mParams = tapNONE;
|
||||
int mSeq = 0;
|
||||
|
||||
public:
|
||||
MetaView& operator= (MetaView const&) = delete;
|
||||
@@ -116,9 +100,7 @@ public:
|
||||
MetaView (Ledger::ref ledger,
|
||||
TransactionEngineParams tep);
|
||||
|
||||
/** Construct a nested view.
|
||||
*/
|
||||
MetaView (MetaView&);
|
||||
MetaView (MetaView& parent);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
@@ -154,11 +136,6 @@ public:
|
||||
return parent_;
|
||||
}
|
||||
|
||||
STAmount
|
||||
deprecatedBalance (AccountID const& account,
|
||||
AccountID const& issuer,
|
||||
STAmount const& amount) const override;
|
||||
|
||||
//---------------------------------------------
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
@@ -176,40 +153,12 @@ public:
|
||||
bool
|
||||
openLedger() const override;
|
||||
|
||||
void
|
||||
deprecatedCreditHint (AccountID const& from,
|
||||
AccountID const& to, STAmount const& amount) override;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/** Apply changes to the parent View */
|
||||
void
|
||||
apply();
|
||||
|
||||
// Swap the contents of two sets
|
||||
void swapWith (MetaView&);
|
||||
|
||||
// VFALCO Only called from RippleCalc.cpp
|
||||
void deprecatedInvalidate()
|
||||
{
|
||||
parent_ = nullptr;
|
||||
mDeferredCredits.reset ();
|
||||
}
|
||||
|
||||
bool isValid () const
|
||||
{
|
||||
return parent_ != nullptr;
|
||||
}
|
||||
|
||||
void bumpSeq ()
|
||||
{
|
||||
++mSeq;
|
||||
}
|
||||
|
||||
void enableDeferredCredits (bool enable=true);
|
||||
|
||||
bool areCreditsDeferred () const;
|
||||
|
||||
// For diagnostics
|
||||
Json::Value getJson (int) const;
|
||||
|
||||
@@ -221,9 +170,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<SLE> const&
|
||||
copyOnRead (list_type::iterator iter);
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
getForMod (uint256 const& key,
|
||||
Mods& mods);
|
||||
@@ -241,29 +187,6 @@ private:
|
||||
SLE const> const& sle, Mods& mods);
|
||||
};
|
||||
|
||||
// DEPRECATED Temporary measure, remove ASAP
|
||||
template <class... Args>
|
||||
inline
|
||||
void
|
||||
reconstruct (MetaView& v, Args&&... args) noexcept
|
||||
{
|
||||
v.~MetaView();
|
||||
new(&v) MetaView(
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class ScopedDeferCredits
|
||||
{
|
||||
private:
|
||||
MetaView& les_;
|
||||
bool enabled_;
|
||||
public:
|
||||
ScopedDeferCredits(MetaView& l);
|
||||
~ScopedDeferCredits ();
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/app/ledger/MetaView.h>
|
||||
#include <ripple/ledger/DeferredCredits.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
@@ -69,35 +67,14 @@ MetaView::MetaView (Ledger::ref ledger,
|
||||
{
|
||||
}
|
||||
|
||||
MetaView::MetaView (MetaView& other)
|
||||
: parent_(&other)
|
||||
, mParent_(&other)
|
||||
, items_(other.items_)
|
||||
, mSet(other.mSet)
|
||||
// VFALCO NOTE This is a change in behavior,
|
||||
// previous version set tapNONE
|
||||
, mParams(other.mParams)
|
||||
, mSeq(other.mSeq + 1)
|
||||
MetaView::MetaView (MetaView& parent)
|
||||
: parent_(&parent)
|
||||
, mParams(parent.mParams)
|
||||
{
|
||||
if (other.mDeferredCredits)
|
||||
mDeferredCredits.emplace();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
std::shared_ptr<SLE> const&
|
||||
MetaView::copyOnRead (
|
||||
list_type::iterator iter)
|
||||
{
|
||||
if (iter->second.mSeq != mSeq)
|
||||
{
|
||||
iter->second.mSeq = mSeq;
|
||||
iter->second.mEntry = std::make_shared<SLE>(
|
||||
*iter->second.mEntry);
|
||||
}
|
||||
return iter->second.mEntry;
|
||||
}
|
||||
|
||||
bool
|
||||
MetaView::exists (Keylet const& k) const
|
||||
{
|
||||
@@ -105,9 +82,9 @@ MetaView::exists (Keylet const& k) const
|
||||
auto const iter = items_.find(k.key);
|
||||
if (iter == items_.end())
|
||||
return parent_->exists(k);
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
if (iter->second.first == taaDELETE)
|
||||
return false;
|
||||
if (! k.check(*iter->second.mEntry))
|
||||
if (! k.check(*iter->second.second))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -132,12 +109,12 @@ MetaView::succ (uint256 const& key,
|
||||
iter = items_.find(*next);
|
||||
}
|
||||
while (iter != items_.end() &&
|
||||
iter->second.mAction == taaDELETE);
|
||||
iter->second.first == taaDELETE);
|
||||
// Find non-deleted successor in our list
|
||||
for (iter = items_.upper_bound(key);
|
||||
iter != items_.end (); ++iter)
|
||||
{
|
||||
if (iter->second.mAction != taaDELETE)
|
||||
if (iter->second.first != taaDELETE)
|
||||
{
|
||||
// Found both, return the lower key
|
||||
if (! next || next > iter->first)
|
||||
@@ -169,10 +146,10 @@ MetaView::read (Keylet const& k) const
|
||||
return nullptr;
|
||||
return sle;
|
||||
}
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
if (iter->second.first == taaDELETE)
|
||||
return nullptr;
|
||||
auto const& sle =
|
||||
iter->second.mEntry;
|
||||
iter->second.second;
|
||||
if (! k.check(*sle))
|
||||
return nullptr;
|
||||
return sle;
|
||||
@@ -191,18 +168,17 @@ MetaView::unchecked_erase (uint256 const& key)
|
||||
using namespace std;
|
||||
items_.emplace_hint(iter, piecewise_construct,
|
||||
forward_as_tuple(key), forward_as_tuple(
|
||||
make_shared<SLE>(*parent_->read(
|
||||
keylet::unchecked(key))),
|
||||
taaDELETE, mSeq));
|
||||
taaDELETE, make_shared<SLE>(
|
||||
*parent_->read(keylet::unchecked(key)))));
|
||||
return true;
|
||||
}
|
||||
if (iter->second.mAction == taaCREATE)
|
||||
if (iter->second.first == taaCREATE)
|
||||
{
|
||||
items_.erase(iter);
|
||||
return true;
|
||||
}
|
||||
assert(iter->second.mAction != taaDELETE);
|
||||
iter->second.mAction = taaDELETE;
|
||||
assert(iter->second.first != taaDELETE);
|
||||
iter->second.first = taaDELETE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -221,11 +197,11 @@ MetaView::unchecked_insert(
|
||||
using namespace std;
|
||||
items_.emplace_hint(iter, piecewise_construct,
|
||||
forward_as_tuple(sle->key()),
|
||||
forward_as_tuple(move(sle),
|
||||
taaCREATE, mSeq));
|
||||
forward_as_tuple(taaCREATE,
|
||||
move(sle)));
|
||||
return;
|
||||
}
|
||||
switch(iter->second.mAction)
|
||||
switch(iter->second.first)
|
||||
{
|
||||
case taaMODIFY:
|
||||
throw std::runtime_error(
|
||||
@@ -243,9 +219,8 @@ MetaView::unchecked_insert(
|
||||
// VFALCO return Keylet from SLE
|
||||
assert(parent_->exists(
|
||||
Keylet{sle->getType(), sle->key()}));
|
||||
iter->second.mSeq = mSeq;
|
||||
iter->second.mEntry = std::move(sle);
|
||||
iter->second.mAction = taaMODIFY;
|
||||
iter->second.first = taaMODIFY;
|
||||
iter->second.second = std::move(sle);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -262,43 +237,16 @@ MetaView::unchecked_replace (std::shared_ptr<SLE>&& sle)
|
||||
using namespace std;
|
||||
items_.emplace_hint(iter, piecewise_construct,
|
||||
forward_as_tuple(sle->key()),
|
||||
forward_as_tuple(move(sle),
|
||||
taaMODIFY, mSeq));
|
||||
forward_as_tuple(taaMODIFY,
|
||||
move(sle)));
|
||||
return;
|
||||
}
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
if (iter->second.first == taaDELETE)
|
||||
throw std::runtime_error(
|
||||
"replace after delete");
|
||||
if (iter->second.mAction != taaCREATE)
|
||||
iter->second.mAction = taaMODIFY;
|
||||
iter->second.mSeq = mSeq;
|
||||
iter->second.mEntry = std::move(sle);
|
||||
}
|
||||
|
||||
STAmount
|
||||
MetaView::deprecatedBalance(
|
||||
AccountID const& account, AccountID const& issuer,
|
||||
STAmount const& amount) const
|
||||
{
|
||||
if (mDeferredCredits)
|
||||
{
|
||||
if (mParent_)
|
||||
{
|
||||
assert (mParent_->mDeferredCredits);
|
||||
return mDeferredCredits->adjustedBalance(
|
||||
account, issuer, mParent_->deprecatedBalance(account, issuer, amount));
|
||||
}
|
||||
|
||||
return mDeferredCredits->adjustedBalance(
|
||||
account, issuer, amount);
|
||||
}
|
||||
else if (mParent_ && mParent_->mDeferredCredits)
|
||||
{
|
||||
return mParent_->mDeferredCredits->adjustedBalance(
|
||||
account, issuer, amount);
|
||||
}
|
||||
|
||||
return amount;
|
||||
if (iter->second.first != taaCREATE)
|
||||
iter->second.first = taaMODIFY;
|
||||
iter->second.second = std::move(sle);
|
||||
}
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
@@ -319,18 +267,15 @@ MetaView::peek (Keylet const& k)
|
||||
iter = items_.emplace_hint (iter,
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(sle->getIndex()),
|
||||
std::forward_as_tuple(
|
||||
std::make_shared<SLE>(
|
||||
*sle), taaCACHED, mSeq));
|
||||
return iter->second.mEntry;
|
||||
std::forward_as_tuple(taaCACHED,
|
||||
std::make_shared<SLE>(*sle)));
|
||||
return iter->second.second;
|
||||
}
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
if (iter->second.first == taaDELETE)
|
||||
return nullptr;
|
||||
auto sle =
|
||||
copyOnRead(iter);
|
||||
if (! k.check(*sle))
|
||||
if (! k.check(*iter->second.second))
|
||||
return nullptr;
|
||||
return sle;
|
||||
return iter->second.second;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -341,19 +286,18 @@ MetaView::erase (std::shared_ptr<SLE> const& sle)
|
||||
assert(iter != items_.end());
|
||||
if (iter == items_.end())
|
||||
return;
|
||||
assert(iter->second.mSeq == mSeq);
|
||||
assert(iter->second.mEntry == sle);
|
||||
assert(iter->second.mAction != taaDELETE);
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
assert(iter->second.first != taaDELETE);
|
||||
assert(iter->second.second == sle);
|
||||
if (iter->second.first == taaDELETE)
|
||||
return;
|
||||
if (iter->second.mAction == taaCREATE)
|
||||
if (iter->second.first == taaCREATE)
|
||||
{
|
||||
items_.erase(iter);
|
||||
return;
|
||||
}
|
||||
assert(iter->second.mAction == taaCACHED ||
|
||||
iter->second.mAction == taaMODIFY);
|
||||
iter->second.mAction = taaDELETE;
|
||||
assert(iter->second.first == taaCACHED ||
|
||||
iter->second.first == taaMODIFY);
|
||||
iter->second.first = taaDELETE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -368,10 +312,10 @@ MetaView::insert (std::shared_ptr<SLE> const& sle)
|
||||
Keylet{sle->getType(), sle->key()}));
|
||||
items_.emplace_hint(iter, std::piecewise_construct,
|
||||
std::forward_as_tuple(sle->getIndex()),
|
||||
std::forward_as_tuple(sle, taaCREATE, mSeq));
|
||||
std::forward_as_tuple(taaCREATE, sle));
|
||||
return;
|
||||
}
|
||||
switch(iter->second.mAction)
|
||||
switch(iter->second.first)
|
||||
{
|
||||
case taaMODIFY:
|
||||
throw std::runtime_error(
|
||||
@@ -389,9 +333,8 @@ MetaView::insert (std::shared_ptr<SLE> const& sle)
|
||||
// Existed in parent, deleted here
|
||||
assert(parent_->exists(
|
||||
Keylet{sle->getType(), sle->key()}));
|
||||
iter->second.mSeq = mSeq;
|
||||
iter->second.mEntry = sle;
|
||||
iter->second.mAction = taaMODIFY;
|
||||
iter->second.first = taaMODIFY;
|
||||
iter->second.second = sle;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -406,17 +349,16 @@ MetaView::update (std::shared_ptr<SLE> const& sle)
|
||||
Keylet{sle->getType(), sle->key()}));
|
||||
items_.emplace_hint(iter, std::piecewise_construct,
|
||||
std::forward_as_tuple(sle->key()),
|
||||
std::forward_as_tuple(sle, taaMODIFY, mSeq));
|
||||
std::forward_as_tuple(taaMODIFY, sle));
|
||||
return;
|
||||
}
|
||||
// VFALCO Should we throw?
|
||||
assert(iter->second.mSeq == mSeq);
|
||||
assert(iter->second.mEntry == sle);
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
assert(iter->second.second == sle);
|
||||
if (iter->second.first == taaDELETE)
|
||||
throw std::runtime_error(
|
||||
"update after delete");
|
||||
if (iter->second.mAction != taaCREATE)
|
||||
iter->second.mAction = taaMODIFY;
|
||||
if (iter->second.first != taaCREATE)
|
||||
iter->second.first = taaMODIFY;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -425,16 +367,6 @@ MetaView::openLedger() const
|
||||
return mParams & tapOPEN_LEDGER;
|
||||
}
|
||||
|
||||
void
|
||||
MetaView::deprecatedCreditHint(
|
||||
AccountID const& from, AccountID const& to,
|
||||
STAmount const& amount)
|
||||
{
|
||||
if (mDeferredCredits)
|
||||
return mDeferredCredits->credit(
|
||||
from, to, amount);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void MetaView::apply()
|
||||
@@ -443,11 +375,11 @@ void MetaView::apply()
|
||||
// Write back the account states
|
||||
for (auto& item : items_)
|
||||
{
|
||||
// VFALCO TODO rvalue move the mEntry, make
|
||||
// VFALCO TODO rvalue move the second, make
|
||||
// sure the mNodes is not used after
|
||||
// this function is called.
|
||||
auto& sle = item.second.mEntry;
|
||||
switch (item.second.mAction)
|
||||
auto& sle = item.second.second;
|
||||
switch (item.second.first)
|
||||
{
|
||||
case taaCACHED:
|
||||
assert(parent_->exists(
|
||||
@@ -477,35 +409,11 @@ void MetaView::apply()
|
||||
}
|
||||
}
|
||||
|
||||
if (mDeferredCredits)
|
||||
{
|
||||
assert (mParent_ != NULL);
|
||||
if (mParent_->areCreditsDeferred())
|
||||
{
|
||||
for (auto& credit : *mDeferredCredits)
|
||||
{
|
||||
// This will go away soon
|
||||
mParent_->mDeferredCredits->merge (credit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Safety precaution since we moved the
|
||||
// entries out, apply() cannot be called twice.
|
||||
items_.clear();
|
||||
}
|
||||
|
||||
void MetaView::swapWith (MetaView& e)
|
||||
{
|
||||
using std::swap;
|
||||
swap (parent_, e.parent_);
|
||||
items_.swap (e.items_);
|
||||
mSet.swap (e.mSet);
|
||||
swap (mParams, e.mParams);
|
||||
swap (mSeq, e.mSeq);
|
||||
swap (mDeferredCredits, e.mDeferredCredits);
|
||||
}
|
||||
|
||||
Json::Value MetaView::getJson (int) const
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
@@ -517,7 +425,7 @@ Json::Value MetaView::getJson (int) const
|
||||
Json::Value entry (Json::objectValue);
|
||||
entry[jss::node] = to_string (it->first);
|
||||
|
||||
switch (it->second.mEntry->getType ())
|
||||
switch (it->second.second->getType ())
|
||||
{
|
||||
case ltINVALID:
|
||||
entry[jss::type] = "invalid";
|
||||
@@ -547,7 +455,7 @@ Json::Value MetaView::getJson (int) const
|
||||
assert (false);
|
||||
}
|
||||
|
||||
switch (it->second.mAction)
|
||||
switch (it->second.first)
|
||||
{
|
||||
case taaCACHED:
|
||||
entry[jss::action] = "cache";
|
||||
@@ -588,15 +496,15 @@ MetaView::getForMod (uint256 const& key,
|
||||
auto iter = items_.find (key);
|
||||
if (iter != items_.end ())
|
||||
{
|
||||
if (iter->second.mAction == taaDELETE)
|
||||
if (iter->second.first == taaDELETE)
|
||||
{
|
||||
WriteLog (lsFATAL, View) <<
|
||||
"Trying to thread to deleted node";
|
||||
return nullptr;
|
||||
}
|
||||
if (iter->second.mAction == taaCACHED)
|
||||
iter->second.mAction = taaMODIFY;
|
||||
return copyOnRead(iter);
|
||||
if (iter->second.first == taaCACHED)
|
||||
iter->second.first = taaMODIFY;
|
||||
return iter->second.second;
|
||||
}
|
||||
{
|
||||
auto miter = mods.find (key);
|
||||
@@ -701,7 +609,7 @@ MetaView::calcRawMeta (Serializer& s,
|
||||
{
|
||||
auto type = &sfGeneric;
|
||||
|
||||
switch (it.second.mAction)
|
||||
switch (it.second.first)
|
||||
{
|
||||
case taaMODIFY:
|
||||
#ifdef META_DEBUG
|
||||
@@ -733,7 +641,7 @@ MetaView::calcRawMeta (Serializer& s,
|
||||
|
||||
auto const origNode =
|
||||
parent_->read(keylet::unchecked(it.first));
|
||||
auto curNode = it.second.mEntry;
|
||||
auto curNode = it.second.second;
|
||||
|
||||
if ((type == &sfModifiedNode) && (*curNode == *origNode))
|
||||
continue;
|
||||
@@ -830,43 +738,4 @@ MetaView::calcRawMeta (Serializer& s,
|
||||
WriteLog (lsTRACE, View) << "Metadata:" << mSet.getJson (0);
|
||||
}
|
||||
|
||||
void MetaView::enableDeferredCredits (bool enable)
|
||||
{
|
||||
assert(enable == !mDeferredCredits);
|
||||
|
||||
if (!enable)
|
||||
{
|
||||
mDeferredCredits.reset ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mDeferredCredits)
|
||||
mDeferredCredits.emplace ();
|
||||
}
|
||||
|
||||
bool MetaView::areCreditsDeferred () const
|
||||
{
|
||||
return static_cast<bool> (mDeferredCredits);
|
||||
}
|
||||
|
||||
ScopedDeferCredits::ScopedDeferCredits (MetaView& l)
|
||||
: les_ (l), enabled_ (false)
|
||||
{
|
||||
if (!les_.areCreditsDeferred ())
|
||||
{
|
||||
WriteLog (lsTRACE, DeferredCredits) << "Enable";
|
||||
les_.enableDeferredCredits (true);
|
||||
enabled_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
ScopedDeferCredits::~ScopedDeferCredits ()
|
||||
{
|
||||
if (enabled_)
|
||||
{
|
||||
WriteLog (lsTRACE, DeferredCredits) << "Disable";
|
||||
les_.enableDeferredCredits (false);
|
||||
}
|
||||
}
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/ledger/tests/common_ledger.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
|
||||
#if 0
|
||||
|
||||
class DeferredCredits_test : public beast::unit_test::suite
|
||||
{
|
||||
/*
|
||||
@@ -168,11 +169,11 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
STAmount const startingAmount =
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig());
|
||||
|
||||
accountSend (les, gw1Acc, aliceAcc, toCredit);
|
||||
accountSend (les, gw1Acc, aliceAcc, toCredit, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount + toCredit);
|
||||
|
||||
accountSend (les, aliceAcc, gw1Acc, toDebit);
|
||||
accountSend (les, aliceAcc, gw1Acc, toDebit, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount + toCredit - toDebit);
|
||||
}
|
||||
@@ -186,11 +187,11 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
STAmount const startingAmount =
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig());
|
||||
|
||||
rippleCredit (les, gw1Acc, aliceAcc, toCredit);
|
||||
rippleCredit (les, gw1Acc, aliceAcc, toCredit, true, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount + toCredit);
|
||||
|
||||
rippleCredit (les, aliceAcc, gw1Acc, toDebit);
|
||||
rippleCredit (les, aliceAcc, gw1Acc, toDebit, true, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount + toCredit - toDebit);
|
||||
}
|
||||
@@ -204,11 +205,11 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
STAmount const startingAmount =
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig());
|
||||
|
||||
accountSend (les, gw1Acc, aliceAcc, toCredit);
|
||||
accountSend (les, gw1Acc, aliceAcc, toCredit, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount);
|
||||
|
||||
accountSend (les, aliceAcc, gw1Acc, toDebit);
|
||||
accountSend (les, aliceAcc, gw1Acc, toDebit, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount - toDebit);
|
||||
}
|
||||
@@ -222,11 +223,11 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
STAmount const startingAmount =
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig());
|
||||
|
||||
rippleCredit (les, gw1Acc, aliceAcc, toCredit);
|
||||
rippleCredit (les, gw1Acc, aliceAcc, toCredit, true, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount);
|
||||
|
||||
rippleCredit (les, aliceAcc, gw1Acc, toDebit);
|
||||
rippleCredit (les, aliceAcc, gw1Acc, toDebit, true, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount - toDebit);
|
||||
}
|
||||
@@ -239,7 +240,7 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig());
|
||||
{
|
||||
ScopedDeferCredits g (les);
|
||||
rippleCredit (les, gw1Acc, aliceAcc, toCredit);
|
||||
rippleCredit (les, gw1Acc, aliceAcc, toCredit, true, {});
|
||||
expect (
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount);
|
||||
@@ -256,7 +257,7 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
les.enableDeferredCredits ();
|
||||
expect (les.areCreditsDeferred ());
|
||||
|
||||
redeemIOU (les, aliceAcc, toDebit, issue);
|
||||
redeemIOU (les, aliceAcc, toDebit, issue, {});
|
||||
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount - toDebit);
|
||||
}
|
||||
@@ -269,7 +270,7 @@ class DeferredCredits_test : public beast::unit_test::suite
|
||||
ScopedDeferCredits g (les);
|
||||
expect (les.areCreditsDeferred ());
|
||||
|
||||
issueIOU (les, aliceAcc, toCredit, issue);
|
||||
issueIOU (les, aliceAcc, toCredit, issue, {});
|
||||
expect (
|
||||
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
|
||||
startingAmount);
|
||||
@@ -289,5 +290,7 @@ public:
|
||||
|
||||
BEAST_DEFINE_TESTSUITE (DeferredCredits, ledger, ripple);
|
||||
|
||||
#endif
|
||||
|
||||
} // test
|
||||
} // ripple
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <ripple/test/jtx.h>
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/ledger/MetaView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <beast/cxx14/type_traits.h> // <type_traits>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <ripple/app/ledger/LedgerTiming.h>
|
||||
#include <ripple/app/ledger/LedgerToJson.h>
|
||||
#include <ripple/app/ledger/OrderBookDB.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/app/main/LoadManager.h>
|
||||
#include <ripple/app/main/LocalCredentials.h>
|
||||
#include <ripple/app/misc/IHashRouter.h>
|
||||
|
||||
@@ -27,7 +27,8 @@ namespace ripple {
|
||||
|
||||
// VFALCO TODO de-inline these function definitions
|
||||
|
||||
class NodeDirectory {
|
||||
class NodeDirectory
|
||||
{
|
||||
public:
|
||||
// Current directory - the last 64 bits of this are the quality.
|
||||
uint256 current;
|
||||
@@ -52,7 +53,7 @@ class NodeDirectory {
|
||||
restartNeeded = true; // Restart at same quality.
|
||||
}
|
||||
|
||||
bool initialize (Book const& book, MetaView& les)
|
||||
bool initialize (Book const& book, View& view)
|
||||
{
|
||||
if (current != zero)
|
||||
return false;
|
||||
@@ -63,7 +64,7 @@ class NodeDirectory {
|
||||
// TODO(tom): it seems impossible that any actual offers with
|
||||
// quality == 0 could occur - we should disallow them, and clear
|
||||
// directory.ledgerEntry without the database call in the next line.
|
||||
ledgerEntry = les.peek (keylet::page(current));
|
||||
ledgerEntry = view.peek (keylet::page(current));
|
||||
|
||||
// Advance, if didn't find it. Normal not to be unable to lookup
|
||||
// firstdirectory. Maybe even skip this lookup.
|
||||
@@ -74,8 +75,17 @@ class NodeDirectory {
|
||||
return bool(ledgerEntry);
|
||||
}
|
||||
|
||||
enum Advance {NO_ADVANCE, NEW_QUALITY, END_ADVANCE};
|
||||
Advance advance(MetaView& les)
|
||||
enum Advance
|
||||
{
|
||||
NO_ADVANCE,
|
||||
NEW_QUALITY,
|
||||
END_ADVANCE
|
||||
};
|
||||
|
||||
/** Advance to the next quality directory in the order book. */
|
||||
// VFALCO Consider renaming this to `nextQuality` or something
|
||||
Advance
|
||||
advance (View& view)
|
||||
{
|
||||
if (!(advanceNeeded || restartNeeded))
|
||||
return NO_ADVANCE;
|
||||
@@ -86,7 +96,7 @@ class NodeDirectory {
|
||||
if (advanceNeeded)
|
||||
{
|
||||
auto const opt =
|
||||
les.succ (current, next);
|
||||
view.succ (current, next);
|
||||
current = opt ? *opt : uint256{};
|
||||
}
|
||||
advanceNeeded = false;
|
||||
@@ -95,7 +105,7 @@ class NodeDirectory {
|
||||
if (current == zero)
|
||||
return END_ADVANCE;
|
||||
|
||||
ledgerEntry = les.peek (keylet::page(current));
|
||||
ledgerEntry = view.peek (keylet::page(current));
|
||||
return NEW_QUALITY;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -483,8 +483,9 @@ Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
|
||||
|
||||
if (valid)
|
||||
{
|
||||
MetaView sandbox(
|
||||
cache->getLedger(), tapNONE);
|
||||
boost::optional<PaymentView> sandbox;
|
||||
sandbox.emplace(cache->getLedger(), tapNONE);
|
||||
|
||||
auto& sourceAccount = !isXRP (currIssuer.account)
|
||||
? currIssuer.account
|
||||
: isXRP (currIssuer.currency)
|
||||
@@ -496,7 +497,7 @@ Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
|
||||
m_journal.debug << iIdentifier
|
||||
<< " Paths found, calling rippleCalc";
|
||||
auto rc = path::RippleCalc::rippleCalculate (
|
||||
sandbox,
|
||||
*sandbox,
|
||||
saMaxAmount,
|
||||
saDstAmount,
|
||||
*raDstAccount,
|
||||
@@ -509,9 +510,9 @@ Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
|
||||
m_journal.debug
|
||||
<< iIdentifier << " Trying with an extra path element";
|
||||
spsPaths.push_back (fullLiquidityPath);
|
||||
reconstruct(sandbox, cache->getLedger (), tapNONE);
|
||||
sandbox.emplace(cache->getLedger (), tapNONE);
|
||||
rc = path::RippleCalc::rippleCalculate (
|
||||
sandbox,
|
||||
*sandbox,
|
||||
saMaxAmount,
|
||||
saDstAmount,
|
||||
*raDstAccount,
|
||||
|
||||
@@ -268,7 +268,7 @@ TER PathState::pushNode (
|
||||
auto const& backNode = nodes_.back ();
|
||||
if (backNode.isAccount())
|
||||
{
|
||||
auto sleRippleState = metaView_.peek(
|
||||
auto sleRippleState = view().peek(
|
||||
keylet::line(backNode.account_, node.account_, backNode.issue_.currency));
|
||||
|
||||
// A "RippleState" means a balance betweeen two accounts for a
|
||||
@@ -291,7 +291,7 @@ TER PathState::pushNode (
|
||||
<< backNode.account_ << " and " << node.account_
|
||||
<< " for " << node.issue_.currency << "." ;
|
||||
|
||||
auto sleBck = metaView_.peek (
|
||||
auto sleBck = view().peek (
|
||||
keylet::account(backNode.account_));
|
||||
// Is the source account the highest numbered account ID?
|
||||
bool bHigh = backNode.account_ > node.account_;
|
||||
@@ -318,13 +318,13 @@ TER PathState::pushNode (
|
||||
|
||||
if (resultCode == tesSUCCESS)
|
||||
{
|
||||
STAmount saOwed = creditBalance (metaView_,
|
||||
STAmount saOwed = creditBalance (view(),
|
||||
node.account_, backNode.account_,
|
||||
node.issue_.currency);
|
||||
STAmount saLimit;
|
||||
|
||||
if (saOwed <= zero) {
|
||||
saLimit = creditLimit (metaView_,
|
||||
saLimit = creditLimit (view(),
|
||||
node.account_,
|
||||
backNode.account_,
|
||||
node.issue_.currency);
|
||||
@@ -624,7 +624,7 @@ void PathState::checkFreeze()
|
||||
// Check each order book for a global freeze
|
||||
if (nodes_[i].uFlags & STPathElement::typeIssuer)
|
||||
{
|
||||
sle = metaView_.peek (keylet::account(nodes_[i].issue_.account));
|
||||
sle = view().peek (keylet::account(nodes_[i].issue_.account));
|
||||
|
||||
if (sle && sle->isFlag (lsfGlobalFreeze))
|
||||
{
|
||||
@@ -642,7 +642,7 @@ void PathState::checkFreeze()
|
||||
|
||||
if (inAccount != outAccount)
|
||||
{
|
||||
sle = metaView_.peek (keylet::account(outAccount));
|
||||
sle = view().peek (keylet::account(outAccount));
|
||||
|
||||
if (sle && sle->isFlag (lsfGlobalFreeze))
|
||||
{
|
||||
@@ -650,7 +650,7 @@ void PathState::checkFreeze()
|
||||
return;
|
||||
}
|
||||
|
||||
sle = metaView_.peek (keylet::line(inAccount,
|
||||
sle = view().peek (keylet::line(inAccount,
|
||||
outAccount, currencyID));
|
||||
|
||||
if (sle && sle->isFlag (
|
||||
@@ -677,9 +677,9 @@ TER PathState::checkNoRipple (
|
||||
Currency const& currency)
|
||||
{
|
||||
// fetch the ripple lines into and out of this node
|
||||
SLE::pointer sleIn = metaView_.peek (
|
||||
SLE::pointer sleIn = view().peek (
|
||||
keylet::line(firstAccount, secondAccount, currency));
|
||||
SLE::pointer sleOut = metaView_.peek (
|
||||
SLE::pointer sleOut = view().peek (
|
||||
keylet::line(secondAccount, thirdAccount, currency));
|
||||
|
||||
if (!sleIn || !sleOut)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/app/ledger/MetaView.h>
|
||||
#include <ripple/app/paths/Node.h>
|
||||
#include <ripple/app/paths/Types.h>
|
||||
#include <ripple/app/paths/impl/PaymentView.h>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace ripple {
|
||||
@@ -35,13 +36,15 @@ class PathState : public CountedObject <PathState>
|
||||
using Ptr = std::shared_ptr<PathState>;
|
||||
using List = std::vector<Ptr>;
|
||||
|
||||
PathState (MetaView& view, STAmount const& saSend, STAmount const& saSendMax)
|
||||
: metaView_ (view)
|
||||
, mIndex (0)
|
||||
PathState (PaymentView& parent,
|
||||
STAmount const& saSend,
|
||||
STAmount const& saSendMax)
|
||||
: mIndex (0)
|
||||
, uQuality (0)
|
||||
, saInReq (saSendMax)
|
||||
, saOutReq (saSend)
|
||||
{
|
||||
view_.emplace(&parent);
|
||||
}
|
||||
|
||||
void reset(STAmount const& in, STAmount const& out);
|
||||
@@ -101,14 +104,15 @@ class PathState : public CountedObject <PathState>
|
||||
|
||||
static bool lessPriority (PathState const& lhs, PathState const& rhs);
|
||||
|
||||
MetaView& metaView()
|
||||
PaymentView&
|
||||
view()
|
||||
{
|
||||
return metaView_;
|
||||
return *view_;
|
||||
}
|
||||
|
||||
void resetView (MetaView& view)
|
||||
void resetView (PaymentView& view)
|
||||
{
|
||||
reconstruct (metaView_, view);
|
||||
view_.emplace(&view);
|
||||
}
|
||||
|
||||
bool isDry() const
|
||||
@@ -136,23 +140,8 @@ private:
|
||||
|
||||
Json::Value getJson () const;
|
||||
|
||||
TER terStatus;
|
||||
path::Node::List nodes_;
|
||||
|
||||
// When processing, don't want to complicate directory walking with
|
||||
// deletion. Offers that became unfunded or were completely consumed go
|
||||
// here and are deleted at the end.
|
||||
OfferIndexList unfundedOffers_;
|
||||
|
||||
// First time scanning foward, as part of path construction, a funding
|
||||
// source was mentioned for accounts. Source may only be used there.
|
||||
AccountIssueToNodeIndex umForward;
|
||||
|
||||
// First time working in reverse a funding source was used.
|
||||
// Source may only be used there if not mentioned by an account.
|
||||
AccountIssueToNodeIndex umReverse;
|
||||
|
||||
MetaView metaView_;
|
||||
private:
|
||||
boost::optional<PaymentView> view_;
|
||||
|
||||
int mIndex; // Index/rank amoung siblings.
|
||||
std::uint64_t uQuality; // 0 = no quality/liquity left.
|
||||
@@ -167,6 +156,23 @@ private:
|
||||
|
||||
// If true, all liquidity on this path has been consumed.
|
||||
bool allLiquidityConsumed_ = false;
|
||||
|
||||
TER terStatus;
|
||||
|
||||
path::Node::List nodes_;
|
||||
|
||||
// When processing, don't want to complicate directory walking with
|
||||
// deletion. Offers that became unfunded or were completely consumed go
|
||||
// here and are deleted at the end.
|
||||
OfferIndexList unfundedOffers_;
|
||||
|
||||
// First time scanning foward, as part of path construction, a funding
|
||||
// source was mentioned for accounts. Source may only be used there.
|
||||
AccountIssueToNodeIndex umForward;
|
||||
|
||||
// First time working in reverse a funding source was used.
|
||||
// Source may only be used there if not mentioned by an account.
|
||||
AccountIssueToNodeIndex umReverse;
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/app/paths/Pathfinder.h>
|
||||
#include <ripple/app/paths/RippleCalc.h>
|
||||
#include <ripple/app/paths/RippleLineCache.h>
|
||||
#include <ripple/app/paths/impl/PaymentView.h>
|
||||
#include <ripple/app/ledger/OrderBookDB.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
@@ -377,7 +378,7 @@ TER Pathfinder::getPathLiquidity (
|
||||
path::RippleCalc::Input rcInput;
|
||||
rcInput.defaultPathsAllowed = false;
|
||||
|
||||
MetaView sandbox (mLedger, tapNONE);
|
||||
PaymentView sandbox (mLedger, tapNONE);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -442,7 +443,7 @@ void Pathfinder::computePathRanks (int maxPaths)
|
||||
// Must subtract liquidity in default path from remaining amount.
|
||||
try
|
||||
{
|
||||
MetaView sandbox (mLedger, tapNONE);
|
||||
PaymentView sandbox (mLedger, tapNONE);
|
||||
|
||||
path::RippleCalc::Input rcInput;
|
||||
rcInput.partialPaymentAllowed = true;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <ripple/app/paths/Tuning.h>
|
||||
#include <ripple/app/paths/RippleCalc.h>
|
||||
#include <ripple/app/paths/cursor/PathCursor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -44,7 +43,7 @@ deleteOffers (View& view,
|
||||
} // namespace
|
||||
|
||||
RippleCalc::Output RippleCalc::rippleCalculate (
|
||||
MetaView& activeLedger,
|
||||
PaymentView& view,
|
||||
|
||||
// Compute paths using this ledger entry set. Up to caller to actually
|
||||
// apply to ledger.
|
||||
@@ -70,7 +69,7 @@ RippleCalc::Output RippleCalc::rippleCalculate (
|
||||
Input const* const pInputs)
|
||||
{
|
||||
RippleCalc rc (
|
||||
activeLedger,
|
||||
view,
|
||||
saMaxAmountReq,
|
||||
saDstAmountReq,
|
||||
uDstAccountID,
|
||||
@@ -94,7 +93,7 @@ RippleCalc::Output RippleCalc::rippleCalculate (
|
||||
bool RippleCalc::addPathState(STPath const& path, TER& resultCode)
|
||||
{
|
||||
auto pathState = std::make_shared<PathState> (
|
||||
metaView, saDstAmountReq_, saMaxAmountReq_);
|
||||
view, saDstAmountReq_, saMaxAmountReq_);
|
||||
|
||||
if (!pathState)
|
||||
{
|
||||
@@ -145,7 +144,6 @@ bool RippleCalc::addPathState(STPath const& path, TER& resultCode)
|
||||
// <-- TER: Only returns tepPATH_PARTIAL if partialPaymentAllowed.
|
||||
TER RippleCalc::rippleCalculate ()
|
||||
{
|
||||
assert (metaView.isValid ());
|
||||
WriteLog (lsTRACE, RippleCalc)
|
||||
<< "rippleCalc>"
|
||||
<< " saMaxAmountReq_:" << saMaxAmountReq_
|
||||
@@ -330,9 +328,8 @@ TER RippleCalc::rippleCalculate ()
|
||||
pathState->unfundedOffers().begin (),
|
||||
pathState->unfundedOffers().end ());
|
||||
|
||||
// Apply best pass' MetaView
|
||||
assert (pathState->metaView().isValid ());
|
||||
pathState->metaView().apply();
|
||||
// Apply best pass' view
|
||||
pathState->view().apply();
|
||||
|
||||
actualAmountIn_ += pathState->inPass();
|
||||
actualAmountOut_ += pathState->outPass();
|
||||
@@ -414,9 +411,9 @@ TER RippleCalc::rippleCalculate ()
|
||||
|
||||
if (resultCode == tesSUCCESS)
|
||||
{
|
||||
resultCode = deleteOffers(metaView, unfundedOffersFromBestPaths);
|
||||
resultCode = deleteOffers(view, unfundedOffersFromBestPaths);
|
||||
if (resultCode == tesSUCCESS)
|
||||
resultCode = deleteOffers(metaView, permanentlyUnfundedOffers_);
|
||||
resultCode = deleteOffers(view, permanentlyUnfundedOffers_);
|
||||
}
|
||||
|
||||
// If isOpenLedger, then ledger is not final, can vote no.
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef RIPPLE_APP_PATHS_RIPPLECALC_H_INCLUDED
|
||||
#define RIPPLE_APP_PATHS_RIPPLECALC_H_INCLUDED
|
||||
|
||||
#include <ripple/app/ledger/MetaView.h>
|
||||
#include <ripple/app/paths/impl/PaymentView.h>
|
||||
#include <ripple/app/paths/PathState.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
@@ -72,8 +72,10 @@ public:
|
||||
|
||||
};
|
||||
|
||||
static Output rippleCalculate (
|
||||
MetaView& activeLedger,
|
||||
static
|
||||
Output
|
||||
rippleCalculate(
|
||||
PaymentView& view,
|
||||
|
||||
// Compute paths using this ledger entry set. Up to caller to actually
|
||||
// apply to ledger.
|
||||
@@ -99,8 +101,7 @@ public:
|
||||
Input const* const pInputs = nullptr);
|
||||
|
||||
// The view we are currently working on
|
||||
MetaView& metaView;
|
||||
|
||||
PaymentView& view;
|
||||
|
||||
// If the transaction fails to meet some constraint, still need to delete
|
||||
// unfunded offers.
|
||||
@@ -116,14 +117,14 @@ public:
|
||||
|
||||
private:
|
||||
RippleCalc (
|
||||
MetaView& activeLedger,
|
||||
PaymentView& view_,
|
||||
STAmount const& saMaxAmountReq, // --> -1 = no limit.
|
||||
STAmount const& saDstAmountReq,
|
||||
|
||||
AccountID const& uDstAccountID,
|
||||
AccountID const& uSrcAccountID,
|
||||
STPathSet const& spsPaths)
|
||||
: metaView (activeLedger),
|
||||
: view (view_),
|
||||
saDstAmountReq_(saDstAmountReq),
|
||||
saMaxAmountReq_(saMaxAmountReq),
|
||||
uDstAccountID_(uDstAccountID),
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/paths/RippleState.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/cursor/RippleLiquidity.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -69,9 +68,9 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
|
||||
bool bDirectDirDirty = node().directory.initialize (
|
||||
{ previousNode().issue_, node().issue_},
|
||||
ledger());
|
||||
view());
|
||||
|
||||
if (auto advance = node().directory.advance (ledger()))
|
||||
if (auto advance = node().directory.advance (view()))
|
||||
{
|
||||
bDirectDirDirty = true;
|
||||
if (advance == NodeDirectory::NEW_QUALITY)
|
||||
@@ -129,7 +128,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
= node().sleOffer->getFieldAmount (sfTakerGets);
|
||||
|
||||
// Funds left.
|
||||
node().saOfferFunds = accountFunds (ledger(),
|
||||
node().saOfferFunds = accountFunds(view(),
|
||||
node().offerOwnerAccount_,
|
||||
node().saTakerGets,
|
||||
fhZERO_IF_FROZEN,
|
||||
@@ -145,7 +144,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
WriteLog (lsTRACE, RippleCalc) << "advanceNode: as is";
|
||||
}
|
||||
}
|
||||
else if (!dirNext (ledger(),
|
||||
else if (!dirNext (view(),
|
||||
node().directory.current,
|
||||
node().directory.ledgerEntry,
|
||||
node().uEntry,
|
||||
@@ -182,7 +181,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
else
|
||||
{
|
||||
// Got a new offer.
|
||||
node().sleOffer = ledger().peek (keylet::offer(node().offerIndex_));
|
||||
node().sleOffer = view().peek (keylet::offer(node().offerIndex_));
|
||||
|
||||
if (!node().sleOffer)
|
||||
{
|
||||
@@ -213,7 +212,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
|
||||
if (node().sleOffer->isFieldPresent (sfExpiration) &&
|
||||
(node().sleOffer->getFieldU32 (sfExpiration) <=
|
||||
getParentCloseTimeNC(ledger())))
|
||||
getParentCloseTimeNC(view())))
|
||||
{
|
||||
// Offer is expired.
|
||||
WriteLog (lsTRACE, RippleCalc)
|
||||
@@ -329,7 +328,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
|
||||
|
||||
// Only the current node is allowed to use the source.
|
||||
|
||||
node().saOfferFunds = accountFunds(ledger(),
|
||||
node().saOfferFunds = accountFunds(view(),
|
||||
node().offerOwnerAccount_,
|
||||
node().saTakerGets,
|
||||
fhZERO_IF_FROZEN,
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/cursor/RippleLiquidity.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -196,7 +195,7 @@ TER PathCursor::deliverNodeForward (
|
||||
|
||||
// Output: Debit offer owner, send XRP or non-XPR to next
|
||||
// account.
|
||||
resultCode = accountSend (ledger(),
|
||||
resultCode = accountSend(view(),
|
||||
node().offerOwnerAccount_,
|
||||
nextNode().account_,
|
||||
saOutPassAct);
|
||||
@@ -253,7 +252,7 @@ TER PathCursor::deliverNodeForward (
|
||||
auto const& id = isXRP(node().issue_) ?
|
||||
xrpAccount() : node().issue_.account;
|
||||
auto outPassTotal = saOutPassAct + saOutPassFees;
|
||||
accountSend (ledger(),
|
||||
accountSend(view(),
|
||||
node().offerOwnerAccount_,
|
||||
id,
|
||||
outPassTotal);
|
||||
@@ -287,7 +286,7 @@ TER PathCursor::deliverNodeForward (
|
||||
{
|
||||
auto id = !isXRP(previousNode().issue_.currency) ?
|
||||
uInAccountID : xrpAccount();
|
||||
resultCode = accountSend (ledger(),
|
||||
resultCode = accountSend(view(),
|
||||
id,
|
||||
node().offerOwnerAccount_,
|
||||
saInPassAct);
|
||||
@@ -317,7 +316,7 @@ TER PathCursor::deliverNodeForward (
|
||||
node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew);
|
||||
node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew);
|
||||
|
||||
ledger().update (node().sleOffer);
|
||||
view().update (node().sleOffer);
|
||||
|
||||
if (saOutPassAct == saOutFunded || saTakerGetsNew == zero)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/cursor/RippleLiquidity.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
|
||||
namespace ripple {
|
||||
@@ -280,7 +279,7 @@ TER PathCursor::deliverNodeReverse (
|
||||
// visited. However, these deductions and adjustments are tenative.
|
||||
//
|
||||
// Must reset balances when going forward to perform actual transfers.
|
||||
resultCode = accountSend (ledger(),
|
||||
resultCode = accountSend(view(),
|
||||
node().offerOwnerAccount_, node().issue_.account, saOutPassAct);
|
||||
|
||||
if (resultCode != tesSUCCESS)
|
||||
@@ -304,7 +303,7 @@ TER PathCursor::deliverNodeReverse (
|
||||
node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew);
|
||||
node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew);
|
||||
|
||||
ledger().update (node().sleOffer);
|
||||
view().update (node().sleOffer);
|
||||
|
||||
if (saOutPassAct == node().saTakerGets)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/cursor/RippleLiquidity.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
|
||||
@@ -56,13 +55,13 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
nextNode().isAccount() ? nextNode().account_ : node().account_;
|
||||
|
||||
std::uint32_t uQualityIn = nodeIndex_
|
||||
? quality_in (ledger(),
|
||||
? quality_in (view(),
|
||||
node().account_,
|
||||
previousAccountID,
|
||||
node().issue_.currency)
|
||||
: QUALITY_ONE;
|
||||
std::uint32_t uQualityOut = (nodeIndex_ == lastNodeIndex)
|
||||
? quality_out (ledger(),
|
||||
? quality_out (view(),
|
||||
node().account_,
|
||||
nextAccountID,
|
||||
node().issue_.currency)
|
||||
@@ -167,7 +166,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
if (saCurReceive)
|
||||
{
|
||||
// Actually receive.
|
||||
resultCode = rippleCredit (ledger(),
|
||||
resultCode = rippleCredit(view(),
|
||||
previousAccountID,
|
||||
node().account_,
|
||||
previousNode().saFwdRedeem + previousNode().saFwdIssue,
|
||||
@@ -235,7 +234,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
previousNode().saFwdRedeem,
|
||||
node().saRevIssue,
|
||||
saPrvRedeemAct,
|
||||
@@ -267,7 +266,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
|
||||
// Adjust prv --> cur balance : take all inbound
|
||||
resultCode = saProvide
|
||||
? rippleCredit (ledger(),
|
||||
? rippleCredit(view(),
|
||||
previousAccountID,
|
||||
node().account_,
|
||||
previousNode().saFwdRedeem + previousNode().saFwdIssue,
|
||||
@@ -304,7 +303,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
previousNode().saFwdRedeem,
|
||||
node().saRevDeliver,
|
||||
saPrvRedeemAct,
|
||||
@@ -332,7 +331,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
|
||||
// Adjust prv --> cur balance : take all inbound
|
||||
resultCode = node().saFwdDeliver
|
||||
? rippleCredit (ledger(),
|
||||
? rippleCredit(view(),
|
||||
previousAccountID, node().account_,
|
||||
previousNode().saFwdRedeem + previousNode().saFwdIssue,
|
||||
false)
|
||||
@@ -354,7 +353,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
if (isXRP (node().issue_))
|
||||
node().saFwdDeliver = std::min (
|
||||
node().saFwdDeliver,
|
||||
accountHolds (ledger(),
|
||||
accountHolds(view(),
|
||||
node().account_,
|
||||
xrpCurrency(),
|
||||
xrpAccount(),
|
||||
@@ -391,7 +390,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
<< "ACCOUNT -- XRP --> offer";
|
||||
|
||||
// Deliver XRP to limbo.
|
||||
resultCode = accountSend (ledger(),
|
||||
resultCode = accountSend(view(),
|
||||
node().account_, xrpAccount(), node().saFwdDeliver);
|
||||
}
|
||||
}
|
||||
@@ -451,7 +450,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
previousNode().saFwdDeliver,
|
||||
node().saRevIssue,
|
||||
saPrvDeliverAct,
|
||||
@@ -482,7 +481,7 @@ TER PathCursor::forwardLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
previousNode().saFwdDeliver,
|
||||
node().saRevDeliver,
|
||||
saPrvDeliverAct,
|
||||
|
||||
@@ -30,7 +30,7 @@ TER PathCursor::liquidity () const
|
||||
TER resultCode = tecPATH_DRY;
|
||||
PathCursor pc = *this;
|
||||
|
||||
pathState_.resetView (rippleCalc_.metaView);
|
||||
pathState_.resetView (rippleCalc_.view);
|
||||
|
||||
for (pc.nodeIndex_ = pc.nodeSize(); pc.nodeIndex_--; )
|
||||
{
|
||||
@@ -59,7 +59,7 @@ TER PathCursor::liquidity () const
|
||||
if (resultCode != tesSUCCESS)
|
||||
return resultCode;
|
||||
|
||||
pathState_.resetView (rippleCalc_.metaView);
|
||||
pathState_.resetView (rippleCalc_.view);
|
||||
|
||||
for (pc.nodeIndex_ = 0; pc.nodeIndex_ < pc.nodeSize(); ++pc.nodeIndex_)
|
||||
{
|
||||
|
||||
@@ -92,11 +92,10 @@ private:
|
||||
STAmount& saInFees) const;
|
||||
|
||||
// VFALCO TODO Rename this to view()
|
||||
MetaView& ledger() const
|
||||
PaymentView&
|
||||
view() const
|
||||
{
|
||||
// VFALCO Rename metaView to view
|
||||
//return rippleCalc_.metaView;
|
||||
return pathState_.metaView();
|
||||
return pathState_.view();
|
||||
}
|
||||
|
||||
NodeIndex nodeSize() const
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/cursor/PathCursor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <tuple>
|
||||
|
||||
@@ -57,7 +56,7 @@ TER PathCursor::reverseLiquidity () const
|
||||
|
||||
// node.transferRate_ caches the output transfer rate for this node.
|
||||
node().transferRate_ = amountFromRate (
|
||||
rippleTransferRate (ledger(), node().issue_.account));
|
||||
rippleTransferRate (view(), node().issue_.account));
|
||||
|
||||
if (node().isAccount ())
|
||||
return reverseLiquidityForAccount ();
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/Credit.h>
|
||||
#include <ripple/app/paths/cursor/RippleLiquidity.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
|
||||
@@ -66,7 +65,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
// This is the quality from from the previous node to this one.
|
||||
const std::uint32_t uQualityIn
|
||||
= (nodeIndex_ != 0)
|
||||
? quality_in (ledger(),
|
||||
? quality_in (view(),
|
||||
node().account_,
|
||||
previousAccountID,
|
||||
node().issue_.currency)
|
||||
@@ -75,7 +74,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
// And this is the quality from the next one to this one.
|
||||
const std::uint32_t uQualityOut
|
||||
= (nodeIndex_ != lastNodeIndex)
|
||||
? quality_out (ledger(),
|
||||
? quality_out (view(),
|
||||
node().account_,
|
||||
nextAccountID,
|
||||
node().issue_.currency)
|
||||
@@ -84,7 +83,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
// For previousNodeIsAccount:
|
||||
// Previous account is already owed.
|
||||
const STAmount saPrvOwed = (previousNodeIsAccount && nodeIndex_ != 0)
|
||||
? creditBalance (ledger(),
|
||||
? creditBalance (view(),
|
||||
node().account_,
|
||||
previousAccountID,
|
||||
node().issue_.currency)
|
||||
@@ -92,7 +91,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
|
||||
// The limit amount that the previous account may owe.
|
||||
const STAmount saPrvLimit = (previousNodeIsAccount && nodeIndex_ != 0)
|
||||
? creditLimit (ledger(),
|
||||
? creditLimit (view(),
|
||||
node().account_,
|
||||
previousAccountID,
|
||||
node().issue_.currency)
|
||||
@@ -100,7 +99,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
|
||||
// Next account is owed.
|
||||
const STAmount saNxtOwed = (nextNodeIsAccount && nodeIndex_ != lastNodeIndex)
|
||||
? creditBalance (ledger(),
|
||||
? creditBalance (view(),
|
||||
node().account_,
|
||||
nextAccountID,
|
||||
node().issue_.currency)
|
||||
@@ -318,7 +317,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
saPrvRedeemReq,
|
||||
node().saRevIssue,
|
||||
previousNode().saRevRedeem,
|
||||
@@ -404,7 +403,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
saPrvRedeemReq,
|
||||
node().saRevDeliver,
|
||||
previousNode().saRevRedeem,
|
||||
@@ -553,7 +552,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
saPrvDeliverReq,
|
||||
node().saRevIssue,
|
||||
previousNode().saRevDeliver,
|
||||
@@ -586,7 +585,7 @@ TER PathCursor::reverseLiquidityForAccount () const
|
||||
rippleLiquidity (
|
||||
rippleCalc_,
|
||||
QUALITY_ONE,
|
||||
rippleTransferRate (ledger(), node().account_),
|
||||
rippleTransferRate (view(), node().account_),
|
||||
saPrvDeliverReq,
|
||||
node().saRevDeliver,
|
||||
previousNode().saRevDeliver,
|
||||
|
||||
50
src/ripple/app/paths/impl/PaymentView.cpp
Normal file
50
src/ripple/app/paths/impl/PaymentView.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
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/paths/impl/PaymentView.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
STAmount
|
||||
PaymentView::balanceHook (AccountID const& account,
|
||||
AccountID const& issuer,
|
||||
STAmount const& amount) const
|
||||
{
|
||||
return tab_.adjustedBalance(
|
||||
account, issuer, amount);
|
||||
}
|
||||
|
||||
void
|
||||
PaymentView::creditHook (AccountID const& from,
|
||||
AccountID const& to,
|
||||
STAmount const& amount)
|
||||
{
|
||||
tab_.credit(from, to, amount);
|
||||
}
|
||||
|
||||
void
|
||||
PaymentView::apply()
|
||||
{
|
||||
view_.apply();
|
||||
if (pv_)
|
||||
pv_->tab_.apply(tab_);
|
||||
}
|
||||
|
||||
} // ripple
|
||||
@@ -18,28 +18,61 @@
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_APP_PAYMENTVIEW_H_INCLUDED
|
||||
#define RIPPLE_APP_PAYMENTVIEW_H_INCLUDED
|
||||
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/app/ledger/MetaView.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/ledger/ViewAPIBasics.h>
|
||||
#include <ripple/ledger/DeferredCredits.h>
|
||||
#include <utility>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** A View wrapper which makes credits unavailable to balances.
|
||||
|
||||
This is used for payments, so that consuming liquidity
|
||||
from a path never causes portions of that path or other
|
||||
paths to gain liquidity.
|
||||
This is used for payments and pathfinding, so that consuming
|
||||
liquidity from a path never causes portions of that path or
|
||||
other paths to gain liquidity.
|
||||
|
||||
The behavior of certain free functions in the View API
|
||||
will change via the balanceHook and creditHook overrides
|
||||
of PaymentView.
|
||||
*/
|
||||
class PaymentView : public View
|
||||
{
|
||||
private:
|
||||
View& view_;
|
||||
MetaView view_;
|
||||
DeferredCredits tab_;
|
||||
PaymentView* pv_ = nullptr;
|
||||
|
||||
public:
|
||||
PaymentView (PaymentView const&) = delete;
|
||||
PaymentView& operator= (PaymentView const&) = delete;
|
||||
|
||||
/** Construct contained MetaView from arguments */
|
||||
template <class... Args>
|
||||
explicit
|
||||
PaymentView (View& view)
|
||||
: view_(view)
|
||||
PaymentView (Args&&... args)
|
||||
: view_ (std::forward<Args>(args)...)
|
||||
{
|
||||
}
|
||||
|
||||
/** Construct on top of existing PaymentView.
|
||||
|
||||
The changes are pushed to the parent when
|
||||
apply() is called.
|
||||
|
||||
@param parent A non-null pointer to the parent.
|
||||
|
||||
@note A pointer is used to prevent confusion
|
||||
with copy construction.
|
||||
*/
|
||||
explicit
|
||||
PaymentView (PaymentView* parent)
|
||||
: view_ (*parent,
|
||||
parent->openLedger())
|
||||
, pv_ (parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -91,15 +124,6 @@ public:
|
||||
return &view_;
|
||||
}
|
||||
|
||||
STAmount
|
||||
deprecatedBalance (AccountID const& account,
|
||||
AccountID const& issuer,
|
||||
STAmount const& amount) const override
|
||||
{
|
||||
return tab_.adjustedBalance(
|
||||
account, issuer, amount);
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
|
||||
std::shared_ptr<SLE>
|
||||
@@ -132,14 +156,20 @@ public:
|
||||
return view_.openLedger();
|
||||
}
|
||||
|
||||
// Unfortunately necessary for DeferredCredits
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
STAmount
|
||||
balanceHook (AccountID const& account,
|
||||
AccountID const& issuer,
|
||||
STAmount const& amount) const override;
|
||||
|
||||
void
|
||||
deprecatedCreditHint (AccountID const& from,
|
||||
creditHook (AccountID const& from,
|
||||
AccountID const& to,
|
||||
STAmount const& amount) override
|
||||
{
|
||||
tab_.credit(from, to, amount);
|
||||
}
|
||||
STAmount const& amount) override;
|
||||
|
||||
void
|
||||
apply();
|
||||
};
|
||||
|
||||
} // ripple
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/BookTip.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <ripple/app/tx/impl/OfferStream.h>
|
||||
#include <ripple/app/tx/impl/Taker.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/OfferStream.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/RippleCalc.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/app/tx/impl/PaymentView.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
|
||||
@@ -295,15 +294,19 @@ public:
|
||||
{
|
||||
path::RippleCalc::Output rc;
|
||||
{
|
||||
ScopedDeferCredits g (mEngine->view ());
|
||||
PaymentView view (mEngine->view());
|
||||
rc = path::RippleCalc::rippleCalculate (
|
||||
mEngine->view (),
|
||||
view,
|
||||
maxSourceAmount,
|
||||
saDstAmount,
|
||||
uDstAccountID,
|
||||
mTxnAccountID,
|
||||
spsPaths,
|
||||
&rcInput);
|
||||
// VFALCO NOTE We might not need to apply, depending
|
||||
// on the TER. But always applying *should*
|
||||
// be safe.
|
||||
view.apply();
|
||||
}
|
||||
|
||||
// TODO: is this right? If the amount is the correct amount, was
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/app/tx/impl/SignerEntries.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/protocol/STObject.h>
|
||||
#include <ripple/protocol/STArray.h>
|
||||
#include <ripple/protocol/STTx.h>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/app/tx/impl/Transactor.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/tx/impl/Taker.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/test/jtx.h>
|
||||
#include <ripple/test/jtx/Account.h>
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/ledger/LedgerConsensus.h>
|
||||
#include <ripple/app/ledger/LedgerTiming.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/app/ledger/tests/common_ledger.h>
|
||||
#include <ripple/basics/seconds_clock.h>
|
||||
#include <ripple/protocol/TxFormats.h>
|
||||
|
||||
@@ -58,8 +58,12 @@ public:
|
||||
AccountID const& receiver,
|
||||
STAmount const& amount);
|
||||
|
||||
void clear ();
|
||||
void apply (DeferredCredits const& child);
|
||||
|
||||
// VFALCO Is this needed?
|
||||
// DEPRECATED
|
||||
void clear ();
|
||||
// DEPRECATED
|
||||
std::map<Key, Value>::iterator begin() { return map_.begin(); }
|
||||
std::map<Key, Value>::iterator end() { return map_.end(); }
|
||||
void merge (std::pair <Key, Value> const& p);
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
#define RIPPLE_LEDGER_VIEW_H_INCLUDED
|
||||
|
||||
#include <ripple/protocol/STLedgerEntry.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/ledger/ViewAPIBasics.h>
|
||||
#include <functional>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace ripple {
|
||||
@@ -154,11 +159,14 @@ public:
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Unfortunately necessary for DeferredCredits
|
||||
// Called to adjust returned balances
|
||||
// This is required to support PaymentView
|
||||
|
||||
virtual
|
||||
STAmount
|
||||
deprecatedBalance (AccountID const& account,
|
||||
AccountID const& issuer, STAmount const& amount) const
|
||||
balanceHook (AccountID const& account,
|
||||
AccountID const& issuer,
|
||||
STAmount const& amount) const
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
@@ -288,15 +296,254 @@ public:
|
||||
bool
|
||||
openLedger() const = 0;
|
||||
|
||||
// Unfortunately necessary for DeferredCredits
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// Called when a credit is made to an account
|
||||
// This is required to support PaymentView
|
||||
virtual
|
||||
void
|
||||
deprecatedCreditHint (AccountID const& from,
|
||||
AccountID const& to, STAmount const& amount)
|
||||
creditHook (AccountID const& from,
|
||||
AccountID const& to,
|
||||
STAmount const& amount)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Observers
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Reflects the fee settings for a particular ledger. */
|
||||
class Fees
|
||||
{
|
||||
private:
|
||||
std::uint64_t base_; // Reference tx cost (drops)
|
||||
std::uint32_t units_; // Reference fee units
|
||||
std::uint32_t reserve_; // Reserve base (drops)
|
||||
std::uint32_t increment_; // Reserve increment (drops)
|
||||
|
||||
public:
|
||||
Fees (BasicView const& view,
|
||||
Config const& config);
|
||||
|
||||
/** Returns the account reserve given the owner count, in drops.
|
||||
|
||||
The reserve is calculated as the reserve base plus
|
||||
the reserve increment times the number of increments.
|
||||
*/
|
||||
std::uint64_t
|
||||
reserve (std::size_t ownerCount) const
|
||||
{
|
||||
return reserve_ + ownerCount * increment_;
|
||||
}
|
||||
};
|
||||
|
||||
bool
|
||||
isGlobalFrozen (BasicView const& view,
|
||||
AccountID const& issuer);
|
||||
|
||||
// Returns the amount an account can spend without going into debt.
|
||||
//
|
||||
// <-- saAmount: amount of currency held by account. May be negative.
|
||||
STAmount
|
||||
accountHolds (BasicView const& view,
|
||||
AccountID const& account, Currency const& currency,
|
||||
AccountID const& issuer, FreezeHandling zeroIfFrozen,
|
||||
Config const& config);
|
||||
|
||||
STAmount
|
||||
accountFunds (BasicView const& view, AccountID const& id,
|
||||
STAmount const& saDefault, FreezeHandling freezeHandling,
|
||||
Config const& config);
|
||||
|
||||
/** Iterate all items in an account's owner directory. */
|
||||
void
|
||||
forEachItem (BasicView const& view, AccountID const& id,
|
||||
std::function<void (std::shared_ptr<SLE const> const&)> f);
|
||||
|
||||
/** Iterate all items after an item in an owner directory.
|
||||
@param after The key of the item to start after
|
||||
@param hint The directory page containing `after`
|
||||
@param limit The maximum number of items to return
|
||||
@return `false` if the iteration failed
|
||||
*/
|
||||
bool
|
||||
forEachItemAfter (BasicView const& view, AccountID const& id,
|
||||
uint256 const& after, std::uint64_t const hint,
|
||||
unsigned int limit, std::function<
|
||||
bool (std::shared_ptr<SLE const> const&)> f);
|
||||
|
||||
std::uint32_t
|
||||
rippleTransferRate (BasicView const& view,
|
||||
AccountID const& issuer);
|
||||
|
||||
std::uint32_t
|
||||
rippleTransferRate (BasicView const& view,
|
||||
AccountID const& uSenderID,
|
||||
AccountID const& uReceiverID,
|
||||
AccountID const& issuer);
|
||||
|
||||
/** Returns `true` if the directory is empty
|
||||
@param key The key of the directory
|
||||
*/
|
||||
bool
|
||||
dirIsEmpty (BasicView const& view,
|
||||
Keylet const& k);
|
||||
|
||||
// Return the first entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
cdirFirst (BasicView const& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory.
|
||||
std::shared_ptr<SLE const>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-- next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
// Return the current entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
cdirNext (BasicView const& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory
|
||||
std::shared_ptr<SLE const>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-> next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Modifiers
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Adjust the owner count up or down. */
|
||||
void
|
||||
adjustOwnerCount (View& view,
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
int amount);
|
||||
|
||||
// Return the first entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
dirFirst (View& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory.
|
||||
std::shared_ptr<SLE>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-- next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
// Return the current entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
dirNext (View& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory
|
||||
std::shared_ptr<SLE>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-> next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
// <-- uNodeDir: For deletion, present to make dirDelete efficient.
|
||||
// --> uRootIndex: The index of the base of the directory. Nodes are based off of this.
|
||||
// --> uLedgerIndex: Value to add to directory.
|
||||
// Only append. This allow for things that watch append only structure to just monitor from the last node on ward.
|
||||
// Within a node with no deletions order of elements is sequential. Otherwise, order of elements is random.
|
||||
TER
|
||||
dirAdd (View& view,
|
||||
std::uint64_t& uNodeDir, // Node of entry.
|
||||
uint256 const& uRootIndex,
|
||||
uint256 const& uLedgerIndex,
|
||||
std::function<void (SLE::ref, bool)> fDescriber);
|
||||
|
||||
TER
|
||||
dirDelete (View& view,
|
||||
const bool bKeepRoot,
|
||||
const std::uint64_t& uNodeDir, // Node item is mentioned in.
|
||||
uint256 const& uRootIndex,
|
||||
uint256 const& uLedgerIndex, // Item being deleted
|
||||
const bool bStable,
|
||||
const bool bSoft);
|
||||
|
||||
// VFALCO NOTE Both STAmount parameters should just
|
||||
// be "Amount", a unit-less number.
|
||||
//
|
||||
/** Create a trust line
|
||||
|
||||
This can set an initial balance.
|
||||
*/
|
||||
TER
|
||||
trustCreate (View& view,
|
||||
const bool bSrcHigh,
|
||||
AccountID const& uSrcAccountID,
|
||||
AccountID const& uDstAccountID,
|
||||
uint256 const& uIndex, // --> ripple state entry
|
||||
SLE::ref sleAccount, // --> the account being set.
|
||||
const bool bAuth, // --> authorize account.
|
||||
const bool bNoRipple, // --> others cannot ripple through
|
||||
const bool bFreeze, // --> funds cannot leave
|
||||
STAmount const& saBalance, // --> balance of account being set.
|
||||
// Issuer should be noAccount()
|
||||
STAmount const& saLimit, // --> limit for account being set.
|
||||
// Issuer should be the account being set.
|
||||
std::uint32_t uSrcQualityIn,
|
||||
std::uint32_t uSrcQualityOut);
|
||||
|
||||
TER
|
||||
trustDelete (View& view,
|
||||
std::shared_ptr<SLE> const& sleRippleState,
|
||||
AccountID const& uLowAccountID,
|
||||
AccountID const& uHighAccountID);
|
||||
|
||||
/** Delete an offer.
|
||||
|
||||
Requirements:
|
||||
The passed `sle` be obtained from a prior
|
||||
call to view.peek()
|
||||
*/
|
||||
TER
|
||||
offerDelete (View& view,
|
||||
std::shared_ptr<SLE> const& sle);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Money Transfers
|
||||
//
|
||||
|
||||
// Direct send w/o fees:
|
||||
// - Redeeming IOUs and/or sending sender's own IOUs.
|
||||
// - Create trust line of needed.
|
||||
// --> bCheckIssuer : normally require issuer to be involved.
|
||||
TER
|
||||
rippleCredit (View& view,
|
||||
AccountID const& uSenderID, AccountID const& uReceiverID,
|
||||
const STAmount & saAmount, bool bCheckIssuer);
|
||||
|
||||
TER
|
||||
accountSend (View& view,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
const STAmount & saAmount);
|
||||
|
||||
TER
|
||||
issueIOU (View& view,
|
||||
AccountID const& account,
|
||||
STAmount const& amount,
|
||||
Issue const& issue);
|
||||
|
||||
TER
|
||||
redeemIOU (View& view,
|
||||
AccountID const& account,
|
||||
STAmount const& amount,
|
||||
Issue const& issue);
|
||||
|
||||
TER
|
||||
transferXRP (View& view,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
STAmount const& amount);
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,272 +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.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_LEDGER_VIEWAPI_H_INCLUDED
|
||||
#define RIPPLE_LEDGER_VIEWAPI_H_INCLUDED
|
||||
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/ledger/ViewAPIBasics.h>
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
#include <ripple/protocol/types.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/*
|
||||
C++ API for reading and writing information in a View.
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Observers
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Reflects the fee settings for a particular ledger. */
|
||||
class Fees
|
||||
{
|
||||
private:
|
||||
std::uint64_t base_; // Reference tx cost (drops)
|
||||
std::uint32_t units_; // Reference fee units
|
||||
std::uint32_t reserve_; // Reserve base (drops)
|
||||
std::uint32_t increment_; // Reserve increment (drops)
|
||||
|
||||
public:
|
||||
Fees (BasicView const& view,
|
||||
Config const& config);
|
||||
|
||||
/** Returns the account reserve given the owner count, in drops.
|
||||
|
||||
The reserve is calculated as the reserve base plus
|
||||
the reserve increment times the number of increments.
|
||||
*/
|
||||
std::uint64_t
|
||||
reserve (std::size_t ownerCount) const
|
||||
{
|
||||
return reserve_ + ownerCount * increment_;
|
||||
}
|
||||
};
|
||||
|
||||
bool
|
||||
isGlobalFrozen (BasicView const& view,
|
||||
AccountID const& issuer);
|
||||
|
||||
// Returns the amount an account can spend without going into debt.
|
||||
//
|
||||
// <-- saAmount: amount of currency held by account. May be negative.
|
||||
STAmount
|
||||
accountHolds (BasicView const& view,
|
||||
AccountID const& account, Currency const& currency,
|
||||
AccountID const& issuer, FreezeHandling zeroIfFrozen,
|
||||
Config const& config);
|
||||
|
||||
STAmount
|
||||
accountFunds (BasicView const& view, AccountID const& id,
|
||||
STAmount const& saDefault, FreezeHandling freezeHandling,
|
||||
Config const& config);
|
||||
|
||||
/** Iterate all items in an account's owner directory. */
|
||||
void
|
||||
forEachItem (BasicView const& view, AccountID const& id,
|
||||
std::function<void (std::shared_ptr<SLE const> const&)> f);
|
||||
|
||||
/** Iterate all items after an item in an owner directory.
|
||||
@param after The key of the item to start after
|
||||
@param hint The directory page containing `after`
|
||||
@param limit The maximum number of items to return
|
||||
@return `false` if the iteration failed
|
||||
*/
|
||||
bool
|
||||
forEachItemAfter (BasicView const& view, AccountID const& id,
|
||||
uint256 const& after, std::uint64_t const hint,
|
||||
unsigned int limit, std::function<
|
||||
bool (std::shared_ptr<SLE const> const&)> f);
|
||||
|
||||
std::uint32_t
|
||||
rippleTransferRate (BasicView const& view,
|
||||
AccountID const& issuer);
|
||||
|
||||
std::uint32_t
|
||||
rippleTransferRate (BasicView const& view,
|
||||
AccountID const& uSenderID,
|
||||
AccountID const& uReceiverID,
|
||||
AccountID const& issuer);
|
||||
|
||||
/** Returns `true` if the directory is empty
|
||||
@param key The key of the directory
|
||||
*/
|
||||
bool
|
||||
dirIsEmpty (BasicView const& view,
|
||||
Keylet const& k);
|
||||
|
||||
// Return the first entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
cdirFirst (BasicView const& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory.
|
||||
std::shared_ptr<SLE const>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-- next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
// Return the current entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
cdirNext (BasicView const& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory
|
||||
std::shared_ptr<SLE const>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-> next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Modifiers
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Adjust the owner count up or down. */
|
||||
void
|
||||
adjustOwnerCount (View& view,
|
||||
std::shared_ptr<SLE> const& sle,
|
||||
int amount);
|
||||
|
||||
// Return the first entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
dirFirst (View& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory.
|
||||
std::shared_ptr<SLE>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-- next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
// Return the current entry and advance uDirEntry.
|
||||
// <-- true, if had a next entry.
|
||||
// VFALCO Fix these clumsy routines with an iterator
|
||||
bool
|
||||
dirNext (View& view,
|
||||
uint256 const& uRootIndex, // --> Root of directory
|
||||
std::shared_ptr<SLE>& sleNode, // <-> current node
|
||||
unsigned int& uDirEntry, // <-> next entry
|
||||
uint256& uEntryIndex); // <-- The entry, if available. Otherwise, zero.
|
||||
|
||||
// <-- uNodeDir: For deletion, present to make dirDelete efficient.
|
||||
// --> uRootIndex: The index of the base of the directory. Nodes are based off of this.
|
||||
// --> uLedgerIndex: Value to add to directory.
|
||||
// Only append. This allow for things that watch append only structure to just monitor from the last node on ward.
|
||||
// Within a node with no deletions order of elements is sequential. Otherwise, order of elements is random.
|
||||
TER
|
||||
dirAdd (View& view,
|
||||
std::uint64_t& uNodeDir, // Node of entry.
|
||||
uint256 const& uRootIndex,
|
||||
uint256 const& uLedgerIndex,
|
||||
std::function<void (SLE::ref, bool)> fDescriber);
|
||||
|
||||
TER
|
||||
dirDelete (View& view,
|
||||
const bool bKeepRoot,
|
||||
const std::uint64_t& uNodeDir, // Node item is mentioned in.
|
||||
uint256 const& uRootIndex,
|
||||
uint256 const& uLedgerIndex, // Item being deleted
|
||||
const bool bStable,
|
||||
const bool bSoft);
|
||||
|
||||
// VFALCO NOTE Both STAmount parameters should just
|
||||
// be "Amount", a unit-less number.
|
||||
//
|
||||
/** Create a trust line
|
||||
|
||||
This can set an initial balance.
|
||||
*/
|
||||
TER
|
||||
trustCreate (View& view,
|
||||
const bool bSrcHigh,
|
||||
AccountID const& uSrcAccountID,
|
||||
AccountID const& uDstAccountID,
|
||||
uint256 const& uIndex, // --> ripple state entry
|
||||
SLE::ref sleAccount, // --> the account being set.
|
||||
const bool bAuth, // --> authorize account.
|
||||
const bool bNoRipple, // --> others cannot ripple through
|
||||
const bool bFreeze, // --> funds cannot leave
|
||||
STAmount const& saBalance, // --> balance of account being set.
|
||||
// Issuer should be noAccount()
|
||||
STAmount const& saLimit, // --> limit for account being set.
|
||||
// Issuer should be the account being set.
|
||||
const std::uint32_t uSrcQualityIn = 0,
|
||||
const std::uint32_t uSrcQualityOut = 0);
|
||||
|
||||
TER
|
||||
trustDelete (View& view,
|
||||
std::shared_ptr<SLE> const& sleRippleState,
|
||||
AccountID const& uLowAccountID,
|
||||
AccountID const& uHighAccountID);
|
||||
|
||||
/** Delete an offer.
|
||||
|
||||
Requirements:
|
||||
The passed `sle` be obtained from a prior
|
||||
call to view.peek()
|
||||
*/
|
||||
TER
|
||||
offerDelete (View& view,
|
||||
std::shared_ptr<SLE> const& sle);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Money Transfers
|
||||
//
|
||||
|
||||
// Direct send w/o fees:
|
||||
// - Redeeming IOUs and/or sending sender's own IOUs.
|
||||
// - Create trust line of needed.
|
||||
// --> bCheckIssuer : normally require issuer to be involved.
|
||||
TER
|
||||
rippleCredit (View& view,
|
||||
AccountID const& uSenderID, AccountID const& uReceiverID,
|
||||
const STAmount & saAmount, bool bCheckIssuer = true);
|
||||
|
||||
TER
|
||||
accountSend (View& view,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
const STAmount & saAmount);
|
||||
|
||||
TER
|
||||
issueIOU (View& view,
|
||||
AccountID const& account,
|
||||
STAmount const& amount,
|
||||
Issue const& issue);
|
||||
|
||||
TER
|
||||
redeemIOU (View& view,
|
||||
AccountID const& account,
|
||||
STAmount const& amount,
|
||||
Issue const& issue);
|
||||
|
||||
TER
|
||||
transferXRP (View& view,
|
||||
AccountID const& from,
|
||||
AccountID const& to,
|
||||
STAmount const& amount);
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -142,6 +142,22 @@ STAmount DeferredCredits::adjustedBalance (AccountID const& main,
|
||||
return result;
|
||||
}
|
||||
|
||||
void DeferredCredits::apply(
|
||||
DeferredCredits const& child)
|
||||
{
|
||||
for (auto& p : child.map_)
|
||||
{
|
||||
auto r =
|
||||
map_.emplace(p);
|
||||
if (! r.second)
|
||||
{
|
||||
using std::get;
|
||||
get<0>(r.first->second) += get<0>(p.second);
|
||||
get<1>(r.first->second) += get<1>(p.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeferredCredits::clear ()
|
||||
{
|
||||
map_.clear ();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
@@ -146,16 +146,14 @@ accountHolds (BasicView const& view,
|
||||
{
|
||||
amount.clear (IssueRef (currency, issuer));
|
||||
}
|
||||
else if (account > issuer)
|
||||
{
|
||||
// Put balance in account terms.
|
||||
amount = sle->getFieldAmount (sfBalance);
|
||||
amount.negate();
|
||||
amount.setIssuer (issuer);
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = sle->getFieldAmount (sfBalance);
|
||||
if (account > issuer)
|
||||
{
|
||||
// Put balance in account terms.
|
||||
amount.negate();
|
||||
}
|
||||
amount.setIssuer (issuer);
|
||||
}
|
||||
WriteLog (lsTRACE, View) << "accountHolds:" <<
|
||||
@@ -163,7 +161,8 @@ accountHolds (BasicView const& view,
|
||||
" amount=" << amount.getFullText ();
|
||||
}
|
||||
|
||||
return view.deprecatedBalance(account, issuer, amount);
|
||||
return view.balanceHook(
|
||||
account, issuer, amount);
|
||||
}
|
||||
|
||||
STAmount
|
||||
@@ -773,8 +772,8 @@ trustCreate (View& view,
|
||||
// Issuer should be noAccount()
|
||||
STAmount const& saLimit, // --> limit for account being set.
|
||||
// Issuer should be the account being set.
|
||||
const std::uint32_t uQualityIn,
|
||||
const std::uint32_t uQualityOut)
|
||||
std::uint32_t uQualityIn,
|
||||
std::uint32_t uQualityOut)
|
||||
{
|
||||
WriteLog (lsTRACE, View)
|
||||
<< "trustCreate: " << to_string (uSrcAccountID) << ", "
|
||||
@@ -868,7 +867,8 @@ trustCreate (View& view,
|
||||
// ONLY: Create ripple balance.
|
||||
sleRippleState->setFieldAmount (sfBalance, bSetHigh ? -saBalance : saBalance);
|
||||
|
||||
view.deprecatedCreditHint (uSrcAccountID, uDstAccountID, saBalance);
|
||||
view.creditHook (uSrcAccountID,
|
||||
uDstAccountID, saBalance);
|
||||
}
|
||||
|
||||
return terResult;
|
||||
@@ -1003,11 +1003,14 @@ rippleCredit (View& view,
|
||||
noRipple,
|
||||
false,
|
||||
saBalance,
|
||||
saReceiverLimit);
|
||||
saReceiverLimit,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
view.deprecatedCreditHint(uSenderID, uReceiverID, saAmount);
|
||||
view.creditHook (uSenderID,
|
||||
uReceiverID, saAmount);
|
||||
|
||||
STAmount saBalance = sleRippleState->getFieldAmount (sfBalance);
|
||||
|
||||
@@ -1133,6 +1136,7 @@ rippleSend (View& view,
|
||||
|
||||
if (uSenderID == issuer || uReceiverID == issuer || issuer == noAccount())
|
||||
{
|
||||
// VFALCO Why do we need this bCheckIssuer?
|
||||
// Direct send: redeeming IOUs and/or sending own IOUs.
|
||||
terResult = rippleCredit (view, uSenderID, uReceiverID, saAmount, false);
|
||||
saActual = saAmount;
|
||||
@@ -1156,10 +1160,10 @@ rippleSend (View& view,
|
||||
" fee=" << saTransitFee.getFullText () <<
|
||||
" cost=" << saActual.getFullText ();
|
||||
|
||||
terResult = rippleCredit (view, issuer, uReceiverID, saAmount);
|
||||
terResult = rippleCredit (view, issuer, uReceiverID, saAmount, true);
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
terResult = rippleCredit (view, uSenderID, issuer, saActual);
|
||||
terResult = rippleCredit (view, uSenderID, issuer, saActual, true);
|
||||
}
|
||||
|
||||
return terResult;
|
||||
@@ -1189,7 +1193,8 @@ accountSend (View& view,
|
||||
return rippleSend (view, uSenderID, uReceiverID, saAmount, saActual);
|
||||
}
|
||||
|
||||
view.deprecatedCreditHint (uSenderID, uReceiverID, saAmount);
|
||||
view.creditHook (uSenderID,
|
||||
uReceiverID, saAmount);
|
||||
|
||||
/* XRP send which does not check reserve and can do pure adjustment.
|
||||
* Note that sender or receiver may be null and this not a mistake; this
|
||||
@@ -1359,7 +1364,7 @@ issueIOU (View& view,
|
||||
bool noRipple = (receiverAccount->getFlags() & lsfDefaultRipple) == 0;
|
||||
|
||||
return trustCreate (view, bSenderHigh, issue.account, account, index,
|
||||
receiverAccount, false, noRipple, false, final_balance, limit);
|
||||
receiverAccount, false, noRipple, false, final_balance, limit, 0, 0);
|
||||
}
|
||||
|
||||
STAmount final_balance = state->getFieldAmount (sfBalance);
|
||||
@@ -1377,7 +1382,8 @@ issueIOU (View& view,
|
||||
if (bSenderHigh)
|
||||
final_balance.negate ();
|
||||
|
||||
view.deprecatedCreditHint (issue.account, account, amount);
|
||||
view.creditHook (issue.account,
|
||||
account, amount);
|
||||
|
||||
// Adjust the balance on the trust line if necessary. We do this even if we
|
||||
// are going to delete the line to reflect the correct balance at the time
|
||||
@@ -1443,7 +1449,8 @@ redeemIOU (View& view,
|
||||
if (bSenderHigh)
|
||||
final_balance.negate ();
|
||||
|
||||
view.deprecatedCreditHint (account, issue.account, amount);
|
||||
view.creditHook (account,
|
||||
issue.account, amount);
|
||||
|
||||
// Adjust the balance on the trust line if necessary. We do this even if we
|
||||
// are going to delete the line to reflect the correct balance at the time
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/rpc/impl/Tuning.h>
|
||||
#include <ripple/app/paths/RippleState.h>
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/rpc/impl/Tuning.h>
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/rpc/impl/AccountFromString.h>
|
||||
#include <ripple/rpc/impl/LookupLedger.h>
|
||||
#include <ripple/app/paths/RippleState.h>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ripple/rpc/impl/Tuning.h>
|
||||
#include <ripple/app/ledger/LedgerFees.h>
|
||||
#include <ripple/ledger/CachedView.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/app/paths/RippleState.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <ripple/app/paths/AccountCurrencies.h>
|
||||
#include <ripple/app/paths/FindPaths.h>
|
||||
#include <ripple/app/paths/RippleCalc.h>
|
||||
#include <ripple/app/paths/impl/PaymentView.h>
|
||||
#include <ripple/core/LoadFeeTrack.h>
|
||||
#include <ripple/protocol/STParsedJSON.h>
|
||||
#include <ripple/protocol/types.h>
|
||||
@@ -281,10 +282,11 @@ ripplePathFind (RippleLineCache::pointer const& cache,
|
||||
STAmount saMaxAmount({ uSrcCurrencyID, issuer }, 1);
|
||||
saMaxAmount.negate();
|
||||
|
||||
MetaView sandbox(lpLedger, tapNONE);
|
||||
boost::optional<PaymentView> sandbox;
|
||||
sandbox.emplace(lpLedger, tapNONE);
|
||||
|
||||
auto rc = path::RippleCalc::rippleCalculate(
|
||||
sandbox,
|
||||
*sandbox,
|
||||
saMaxAmount, // --> Amount to send is unlimited
|
||||
// to get an estimate.
|
||||
saDstAmount, // --> Amount to deliver.
|
||||
@@ -306,9 +308,9 @@ ripplePathFind (RippleLineCache::pointer const& cache,
|
||||
<< "Trying with an extra path element";
|
||||
|
||||
spsComputed.push_back(fullLiquidityPath);
|
||||
reconstruct(sandbox, lpLedger, tapNONE);
|
||||
sandbox.emplace(lpLedger, tapNONE);
|
||||
rc = path::RippleCalc::rippleCalculate(
|
||||
sandbox,
|
||||
*sandbox,
|
||||
saMaxAmount, // --> Amount to send is unlimited
|
||||
// to get an estimate.
|
||||
saDstAmount, // --> Amount to deliver.
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/ledger/ViewAPI.h>
|
||||
#include <ripple/test/jtx/owners.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -24,16 +24,13 @@
|
||||
#include <ripple/app/paths/Credit.cpp>
|
||||
#include <ripple/app/paths/FindPaths.cpp>
|
||||
#include <ripple/app/paths/Pathfinder.cpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push)
|
||||
//#pragma warning (disable: 4309) // truncation of constant value
|
||||
#endif
|
||||
#include <ripple/app/paths/Node.cpp>
|
||||
#include <ripple/app/paths/PathRequest.cpp>
|
||||
#include <ripple/app/paths/PathRequests.cpp>
|
||||
#include <ripple/app/paths/PathState.cpp>
|
||||
#include <ripple/app/paths/RippleCalc.cpp>
|
||||
#include <ripple/app/paths/RippleLineCache.cpp>
|
||||
|
||||
#include <ripple/app/paths/cursor/AdvanceNode.cpp>
|
||||
#include <ripple/app/paths/cursor/DeliverNodeForward.cpp>
|
||||
#include <ripple/app/paths/cursor/DeliverNodeReverse.cpp>
|
||||
@@ -44,7 +41,5 @@
|
||||
#include <ripple/app/paths/cursor/ReverseLiquidity.cpp>
|
||||
#include <ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp>
|
||||
#include <ripple/app/paths/cursor/RippleLiquidity.cpp>
|
||||
#include <ripple/app/paths/RippleLineCache.cpp>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#include <ripple/app/paths/impl/PaymentView.cpp>
|
||||
|
||||
@@ -19,29 +19,28 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
|
||||
#include <ripple/app/tx/impl/BookTip.cpp>
|
||||
#include <ripple/app/tx/impl/CancelOffer.cpp>
|
||||
#include <ripple/app/tx/impl/CancelTicket.cpp>
|
||||
#include <ripple/app/tx/impl/Change.cpp>
|
||||
#include <ripple/app/tx/impl/CreateOffer.cpp>
|
||||
#include <ripple/app/tx/impl/CreateTicket.cpp>
|
||||
#include <ripple/app/tx/impl/InboundTransactions.cpp>
|
||||
#include <ripple/app/tx/impl/LocalTxs.cpp>
|
||||
#include <ripple/app/tx/impl/OfferStream.cpp>
|
||||
#include <ripple/app/tx/impl/Payment.cpp>
|
||||
#include <ripple/app/tx/impl/SetAccount.cpp>
|
||||
#include <ripple/app/tx/impl/SetRegularKey.cpp>
|
||||
#include <ripple/app/tx/impl/SetSignerList.cpp>
|
||||
#include <ripple/app/tx/impl/SetTrust.cpp>
|
||||
#include <ripple/app/tx/impl/SignerEntries.cpp>
|
||||
#include <ripple/app/tx/impl/Taker.cpp>
|
||||
#include <ripple/app/tx/impl/TransactionMaster.cpp>
|
||||
#include <ripple/app/tx/impl/Transaction.cpp>
|
||||
#include <ripple/app/tx/impl/TransactionEngine.cpp>
|
||||
#include <ripple/app/tx/impl/TransactionMeta.cpp>
|
||||
#include <ripple/app/tx/impl/TransactionAcquire.cpp>
|
||||
#include <ripple/app/tx/impl/Transactor.cpp>
|
||||
#include <ripple/app/tx/impl/BookTip.cpp>
|
||||
#include <ripple/app/tx/impl/OfferStream.cpp>
|
||||
#include <ripple/app/tx/impl/Taker.cpp>
|
||||
|
||||
#include <ripple/app/tx/impl/Change.cpp>
|
||||
#include <ripple/app/tx/impl/CancelOffer.cpp>
|
||||
#include <ripple/app/tx/impl/Payment.cpp>
|
||||
#include <ripple/app/tx/impl/SetRegularKey.cpp>
|
||||
#include <ripple/app/tx/impl/SetAccount.cpp>
|
||||
#include <ripple/app/tx/impl/SetTrust.cpp>
|
||||
#include <ripple/app/tx/impl/CreateOffer.cpp>
|
||||
#include <ripple/app/tx/impl/CreateTicket.cpp>
|
||||
#include <ripple/app/tx/impl/CancelTicket.cpp>
|
||||
#include <ripple/app/tx/impl/SetSignerList.cpp>
|
||||
#include <ripple/app/tx/impl/SignerEntries.cpp>
|
||||
|
||||
#include <ripple/app/tx/tests/common_transactor.cpp>
|
||||
#include <ripple/app/tx/tests/MultiSign.test.cpp>
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
|
||||
#include <ripple/ledger/impl/DeferredCredits.cpp>
|
||||
#include <ripple/ledger/impl/CachedView.cpp>
|
||||
#include <ripple/ledger/impl/ViewAPI.cpp>
|
||||
#include <ripple/ledger/impl/DeferredCredits.cpp>
|
||||
#include <ripple/ledger/impl/View.cpp>
|
||||
|
||||
Reference in New Issue
Block a user