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:
Vinnie Falco
2015-06-24 05:07:20 -07:00
parent f535304e1b
commit 48d6a4ab6a
53 changed files with 651 additions and 782 deletions

View File

@@ -1647,6 +1647,12 @@
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h"> <ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h">
</ClInclude> </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"> <ClCompile Include="..\..\src\ripple\app\paths\Node.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
@@ -1751,8 +1757,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\app\tx\impl\PaymentView.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\app\tx\impl\SetAccount.cpp"> <ClCompile Include="..\..\src\ripple\app\tx\impl\SetAccount.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
@@ -2261,7 +2265,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
</ClCompile> </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)'=='debug|x64'">True</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
</ClCompile> </ClCompile>
@@ -2269,8 +2273,6 @@
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\ledger\View.h"> <ClInclude Include="..\..\src\ripple\ledger\View.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\ledger\ViewAPI.h">
</ClInclude>
<ClInclude Include="..\..\src\ripple\ledger\ViewAPIBasics.h"> <ClInclude Include="..\..\src\ripple\ledger\ViewAPIBasics.h">
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\net\HTTPClient.h"> <ClInclude Include="..\..\src\ripple\net\HTTPClient.h">

View File

@@ -271,6 +271,9 @@
<Filter Include="ripple\app\paths\cursor"> <Filter Include="ripple\app\paths\cursor">
<UniqueIdentifier>{9AD8D049-10A8-704C-D51A-FAD55B1F235F}</UniqueIdentifier> <UniqueIdentifier>{9AD8D049-10A8-704C-D51A-FAD55B1F235F}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="ripple\app\paths\impl">
<UniqueIdentifier>{38932157-7DA1-A9CC-CABC-2A3D9CACF188}</UniqueIdentifier>
</Filter>
<Filter Include="ripple\app\tests"> <Filter Include="ripple\app\tests">
<UniqueIdentifier>{2E791662-6ED0-D1E1-03A4-0CB35473EC56}</UniqueIdentifier> <UniqueIdentifier>{2E791662-6ED0-D1E1-03A4-0CB35473EC56}</UniqueIdentifier>
</Filter> </Filter>
@@ -2373,6 +2376,12 @@
<ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h"> <ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h">
<Filter>ripple\app\paths</Filter> <Filter>ripple\app\paths</Filter>
</ClInclude> </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"> <ClCompile Include="..\..\src\ripple\app\paths\Node.cpp">
<Filter>ripple\app\paths</Filter> <Filter>ripple\app\paths</Filter>
</ClCompile> </ClCompile>
@@ -2472,9 +2481,6 @@
<ClCompile Include="..\..\src\ripple\app\tx\impl\Payment.cpp"> <ClCompile Include="..\..\src\ripple\app\tx\impl\Payment.cpp">
<Filter>ripple\app\tx\impl</Filter> <Filter>ripple\app\tx\impl</Filter>
</ClCompile> </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"> <ClCompile Include="..\..\src\ripple\app\tx\impl\SetAccount.cpp">
<Filter>ripple\app\tx\impl</Filter> <Filter>ripple\app\tx\impl</Filter>
</ClCompile> </ClCompile>
@@ -2964,7 +2970,7 @@
<ClCompile Include="..\..\src\ripple\ledger\impl\DeferredCredits.cpp"> <ClCompile Include="..\..\src\ripple\ledger\impl\DeferredCredits.cpp">
<Filter>ripple\ledger\impl</Filter> <Filter>ripple\ledger\impl</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\ledger\impl\ViewAPI.cpp"> <ClCompile Include="..\..\src\ripple\ledger\impl\View.cpp">
<Filter>ripple\ledger\impl</Filter> <Filter>ripple\ledger\impl</Filter>
</ClCompile> </ClCompile>
<ClInclude Include="..\..\src\ripple\ledger\SLECache.h"> <ClInclude Include="..\..\src\ripple\ledger\SLECache.h">
@@ -2973,9 +2979,6 @@
<ClInclude Include="..\..\src\ripple\ledger\View.h"> <ClInclude Include="..\..\src\ripple\ledger\View.h">
<Filter>ripple\ledger</Filter> <Filter>ripple\ledger</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\ledger\ViewAPI.h">
<Filter>ripple\ledger</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\ledger\ViewAPIBasics.h"> <ClInclude Include="..\..\src\ripple\ledger\ViewAPIBasics.h">
<Filter>ripple\ledger</Filter> <Filter>ripple\ledger</Filter>
</ClInclude> </ClInclude>

View File

@@ -21,7 +21,6 @@
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/ledger/AcceptedLedgerTx.h> #include <ripple/app/ledger/AcceptedLedgerTx.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/StringUtilities.h> #include <ripple/basics/StringUtilities.h>
#include <ripple/protocol/JsonFields.h> #include <ripple/protocol/JsonFields.h>
#include <ripple/protocol/types.h> #include <ripple/protocol/types.h>

View File

@@ -21,7 +21,6 @@
#define RIPPLE_LEDGER_METAVIEW_H_INCLUDED #define RIPPLE_LEDGER_METAVIEW_H_INCLUDED
#include <ripple/app/ledger/Ledger.h> #include <ripple/app/ledger/Ledger.h>
#include <ripple/ledger/DeferredCredits.h>
#include <ripple/basics/CountedObject.h> #include <ripple/basics/CountedObject.h>
#include <ripple/ledger/ViewAPIBasics.h> #include <ripple/ledger/ViewAPIBasics.h>
#include <ripple/protocol/Keylet.h> #include <ripple/protocol/Keylet.h>
@@ -65,9 +64,6 @@ enum TransactionEngineParams
class MetaView : public View class MetaView : public View
{ {
private: private:
using Mods =
hash_map<uint256, SLE::pointer>;
enum Action enum Action
{ {
taaCACHED, // Unmodified. taaCACHED, // Unmodified.
@@ -76,30 +72,18 @@ private:
taaCREATE, // Newly created. taaCREATE, // Newly created.
}; };
class Item using Item = std::pair<Action,
{ std::shared_ptr<SLE>>;
public:
int mSeq;
Action mAction;
std::shared_ptr<SLE> mEntry;
Item (SLE::ref e, Action a, int s) using Mods = hash_map<uint256,
: mSeq (s) std::shared_ptr<SLE>>;
, mAction (a)
, mEntry (e)
{
}
};
using list_type = std::map<uint256, Item>; using list_type = std::map<uint256, Item>;
BasicView* parent_; BasicView* parent_;
MetaView* mParent_ = NULL;
list_type items_; list_type items_;
boost::optional<DeferredCredits> mDeferredCredits;
TransactionMetaSet mSet; TransactionMetaSet mSet;
TransactionEngineParams mParams = tapNONE; TransactionEngineParams mParams = tapNONE;
int mSeq = 0;
public: public:
MetaView& operator= (MetaView const&) = delete; MetaView& operator= (MetaView const&) = delete;
@@ -116,9 +100,7 @@ public:
MetaView (Ledger::ref ledger, MetaView (Ledger::ref ledger,
TransactionEngineParams tep); TransactionEngineParams tep);
/** Construct a nested view. MetaView (MetaView& parent);
*/
MetaView (MetaView&);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// //
@@ -154,11 +136,6 @@ public:
return parent_; return parent_;
} }
STAmount
deprecatedBalance (AccountID const& account,
AccountID const& issuer,
STAmount const& amount) const override;
//--------------------------------------------- //---------------------------------------------
std::shared_ptr<SLE> std::shared_ptr<SLE>
@@ -176,40 +153,12 @@ public:
bool bool
openLedger() const override; openLedger() const override;
void
deprecatedCreditHint (AccountID const& from,
AccountID const& to, STAmount const& amount) override;
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** Apply changes to the parent View */ /** Apply changes to the parent View */
void void
apply(); 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 // For diagnostics
Json::Value getJson (int) const; Json::Value getJson (int) const;
@@ -221,9 +170,6 @@ public:
} }
private: private:
std::shared_ptr<SLE> const&
copyOnRead (list_type::iterator iter);
std::shared_ptr<SLE> std::shared_ptr<SLE>
getForMod (uint256 const& key, getForMod (uint256 const& key,
Mods& mods); Mods& mods);
@@ -241,29 +187,6 @@ private:
SLE const> const& sle, Mods& mods); 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 } // ripple
#endif #endif

View File

@@ -22,8 +22,6 @@
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/app/ledger/MetaView.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/Log.h>
#include <ripple/basics/StringUtilities.h> #include <ripple/basics/StringUtilities.h>
#include <ripple/json/to_string.h> #include <ripple/json/to_string.h>
@@ -69,35 +67,14 @@ MetaView::MetaView (Ledger::ref ledger,
{ {
} }
MetaView::MetaView (MetaView& other) MetaView::MetaView (MetaView& parent)
: parent_(&other) : parent_(&parent)
, mParent_(&other) , mParams(parent.mParams)
, 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)
{ {
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 bool
MetaView::exists (Keylet const& k) const MetaView::exists (Keylet const& k) const
{ {
@@ -105,9 +82,9 @@ MetaView::exists (Keylet const& k) const
auto const iter = items_.find(k.key); auto const iter = items_.find(k.key);
if (iter == items_.end()) if (iter == items_.end())
return parent_->exists(k); return parent_->exists(k);
if (iter->second.mAction == taaDELETE) if (iter->second.first == taaDELETE)
return false; return false;
if (! k.check(*iter->second.mEntry)) if (! k.check(*iter->second.second))
return false; return false;
return true; return true;
} }
@@ -132,12 +109,12 @@ MetaView::succ (uint256 const& key,
iter = items_.find(*next); iter = items_.find(*next);
} }
while (iter != items_.end() && while (iter != items_.end() &&
iter->second.mAction == taaDELETE); iter->second.first == taaDELETE);
// Find non-deleted successor in our list // Find non-deleted successor in our list
for (iter = items_.upper_bound(key); for (iter = items_.upper_bound(key);
iter != items_.end (); ++iter) iter != items_.end (); ++iter)
{ {
if (iter->second.mAction != taaDELETE) if (iter->second.first != taaDELETE)
{ {
// Found both, return the lower key // Found both, return the lower key
if (! next || next > iter->first) if (! next || next > iter->first)
@@ -169,10 +146,10 @@ MetaView::read (Keylet const& k) const
return nullptr; return nullptr;
return sle; return sle;
} }
if (iter->second.mAction == taaDELETE) if (iter->second.first == taaDELETE)
return nullptr; return nullptr;
auto const& sle = auto const& sle =
iter->second.mEntry; iter->second.second;
if (! k.check(*sle)) if (! k.check(*sle))
return nullptr; return nullptr;
return sle; return sle;
@@ -191,18 +168,17 @@ MetaView::unchecked_erase (uint256 const& key)
using namespace std; using namespace std;
items_.emplace_hint(iter, piecewise_construct, items_.emplace_hint(iter, piecewise_construct,
forward_as_tuple(key), forward_as_tuple( forward_as_tuple(key), forward_as_tuple(
make_shared<SLE>(*parent_->read( taaDELETE, make_shared<SLE>(
keylet::unchecked(key))), *parent_->read(keylet::unchecked(key)))));
taaDELETE, mSeq));
return true; return true;
} }
if (iter->second.mAction == taaCREATE) if (iter->second.first == taaCREATE)
{ {
items_.erase(iter); items_.erase(iter);
return true; return true;
} }
assert(iter->second.mAction != taaDELETE); assert(iter->second.first != taaDELETE);
iter->second.mAction = taaDELETE; iter->second.first = taaDELETE;
return true; return true;
} }
@@ -221,11 +197,11 @@ MetaView::unchecked_insert(
using namespace std; using namespace std;
items_.emplace_hint(iter, piecewise_construct, items_.emplace_hint(iter, piecewise_construct,
forward_as_tuple(sle->key()), forward_as_tuple(sle->key()),
forward_as_tuple(move(sle), forward_as_tuple(taaCREATE,
taaCREATE, mSeq)); move(sle)));
return; return;
} }
switch(iter->second.mAction) switch(iter->second.first)
{ {
case taaMODIFY: case taaMODIFY:
throw std::runtime_error( throw std::runtime_error(
@@ -243,9 +219,8 @@ MetaView::unchecked_insert(
// VFALCO return Keylet from SLE // VFALCO return Keylet from SLE
assert(parent_->exists( assert(parent_->exists(
Keylet{sle->getType(), sle->key()})); Keylet{sle->getType(), sle->key()}));
iter->second.mSeq = mSeq; iter->second.first = taaMODIFY;
iter->second.mEntry = std::move(sle); iter->second.second = std::move(sle);
iter->second.mAction = taaMODIFY;
} }
void void
@@ -262,43 +237,16 @@ MetaView::unchecked_replace (std::shared_ptr<SLE>&& sle)
using namespace std; using namespace std;
items_.emplace_hint(iter, piecewise_construct, items_.emplace_hint(iter, piecewise_construct,
forward_as_tuple(sle->key()), forward_as_tuple(sle->key()),
forward_as_tuple(move(sle), forward_as_tuple(taaMODIFY,
taaMODIFY, mSeq)); move(sle)));
return; return;
} }
if (iter->second.mAction == taaDELETE) if (iter->second.first == taaDELETE)
throw std::runtime_error( throw std::runtime_error(
"replace after delete"); "replace after delete");
if (iter->second.mAction != taaCREATE) if (iter->second.first != taaCREATE)
iter->second.mAction = taaMODIFY; iter->second.first = taaMODIFY;
iter->second.mSeq = mSeq; iter->second.second = std::move(sle);
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;
} }
std::shared_ptr<SLE> std::shared_ptr<SLE>
@@ -319,18 +267,15 @@ MetaView::peek (Keylet const& k)
iter = items_.emplace_hint (iter, iter = items_.emplace_hint (iter,
std::piecewise_construct, std::piecewise_construct,
std::forward_as_tuple(sle->getIndex()), std::forward_as_tuple(sle->getIndex()),
std::forward_as_tuple( std::forward_as_tuple(taaCACHED,
std::make_shared<SLE>( std::make_shared<SLE>(*sle)));
*sle), taaCACHED, mSeq)); return iter->second.second;
return iter->second.mEntry;
} }
if (iter->second.mAction == taaDELETE) if (iter->second.first == taaDELETE)
return nullptr; return nullptr;
auto sle = if (! k.check(*iter->second.second))
copyOnRead(iter);
if (! k.check(*sle))
return nullptr; return nullptr;
return sle; return iter->second.second;
} }
void void
@@ -341,19 +286,18 @@ MetaView::erase (std::shared_ptr<SLE> const& sle)
assert(iter != items_.end()); assert(iter != items_.end());
if (iter == items_.end()) if (iter == items_.end())
return; return;
assert(iter->second.mSeq == mSeq); assert(iter->second.first != taaDELETE);
assert(iter->second.mEntry == sle); assert(iter->second.second == sle);
assert(iter->second.mAction != taaDELETE); if (iter->second.first == taaDELETE)
if (iter->second.mAction == taaDELETE)
return; return;
if (iter->second.mAction == taaCREATE) if (iter->second.first == taaCREATE)
{ {
items_.erase(iter); items_.erase(iter);
return; return;
} }
assert(iter->second.mAction == taaCACHED || assert(iter->second.first == taaCACHED ||
iter->second.mAction == taaMODIFY); iter->second.first == taaMODIFY);
iter->second.mAction = taaDELETE; iter->second.first = taaDELETE;
} }
void void
@@ -368,10 +312,10 @@ MetaView::insert (std::shared_ptr<SLE> const& sle)
Keylet{sle->getType(), sle->key()})); Keylet{sle->getType(), sle->key()}));
items_.emplace_hint(iter, std::piecewise_construct, items_.emplace_hint(iter, std::piecewise_construct,
std::forward_as_tuple(sle->getIndex()), std::forward_as_tuple(sle->getIndex()),
std::forward_as_tuple(sle, taaCREATE, mSeq)); std::forward_as_tuple(taaCREATE, sle));
return; return;
} }
switch(iter->second.mAction) switch(iter->second.first)
{ {
case taaMODIFY: case taaMODIFY:
throw std::runtime_error( throw std::runtime_error(
@@ -389,9 +333,8 @@ MetaView::insert (std::shared_ptr<SLE> const& sle)
// Existed in parent, deleted here // Existed in parent, deleted here
assert(parent_->exists( assert(parent_->exists(
Keylet{sle->getType(), sle->key()})); Keylet{sle->getType(), sle->key()}));
iter->second.mSeq = mSeq; iter->second.first = taaMODIFY;
iter->second.mEntry = sle; iter->second.second = sle;
iter->second.mAction = taaMODIFY;
} }
void void
@@ -406,17 +349,16 @@ MetaView::update (std::shared_ptr<SLE> const& sle)
Keylet{sle->getType(), sle->key()})); Keylet{sle->getType(), sle->key()}));
items_.emplace_hint(iter, std::piecewise_construct, items_.emplace_hint(iter, std::piecewise_construct,
std::forward_as_tuple(sle->key()), std::forward_as_tuple(sle->key()),
std::forward_as_tuple(sle, taaMODIFY, mSeq)); std::forward_as_tuple(taaMODIFY, sle));
return; return;
} }
// VFALCO Should we throw? // VFALCO Should we throw?
assert(iter->second.mSeq == mSeq); assert(iter->second.second == sle);
assert(iter->second.mEntry == sle); if (iter->second.first == taaDELETE)
if (iter->second.mAction == taaDELETE)
throw std::runtime_error( throw std::runtime_error(
"update after delete"); "update after delete");
if (iter->second.mAction != taaCREATE) if (iter->second.first != taaCREATE)
iter->second.mAction = taaMODIFY; iter->second.first = taaMODIFY;
} }
bool bool
@@ -425,16 +367,6 @@ MetaView::openLedger() const
return mParams & tapOPEN_LEDGER; 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() void MetaView::apply()
@@ -443,11 +375,11 @@ void MetaView::apply()
// Write back the account states // Write back the account states
for (auto& item : items_) 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 // sure the mNodes is not used after
// this function is called. // this function is called.
auto& sle = item.second.mEntry; auto& sle = item.second.second;
switch (item.second.mAction) switch (item.second.first)
{ {
case taaCACHED: case taaCACHED:
assert(parent_->exists( 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 // Safety precaution since we moved the
// entries out, apply() cannot be called twice. // entries out, apply() cannot be called twice.
items_.clear(); 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 MetaView::getJson (int) const
{ {
Json::Value ret (Json::objectValue); Json::Value ret (Json::objectValue);
@@ -517,7 +425,7 @@ Json::Value MetaView::getJson (int) const
Json::Value entry (Json::objectValue); Json::Value entry (Json::objectValue);
entry[jss::node] = to_string (it->first); entry[jss::node] = to_string (it->first);
switch (it->second.mEntry->getType ()) switch (it->second.second->getType ())
{ {
case ltINVALID: case ltINVALID:
entry[jss::type] = "invalid"; entry[jss::type] = "invalid";
@@ -547,7 +455,7 @@ Json::Value MetaView::getJson (int) const
assert (false); assert (false);
} }
switch (it->second.mAction) switch (it->second.first)
{ {
case taaCACHED: case taaCACHED:
entry[jss::action] = "cache"; entry[jss::action] = "cache";
@@ -588,15 +496,15 @@ MetaView::getForMod (uint256 const& key,
auto iter = items_.find (key); auto iter = items_.find (key);
if (iter != items_.end ()) if (iter != items_.end ())
{ {
if (iter->second.mAction == taaDELETE) if (iter->second.first == taaDELETE)
{ {
WriteLog (lsFATAL, View) << WriteLog (lsFATAL, View) <<
"Trying to thread to deleted node"; "Trying to thread to deleted node";
return nullptr; return nullptr;
} }
if (iter->second.mAction == taaCACHED) if (iter->second.first == taaCACHED)
iter->second.mAction = taaMODIFY; iter->second.first = taaMODIFY;
return copyOnRead(iter); return iter->second.second;
} }
{ {
auto miter = mods.find (key); auto miter = mods.find (key);
@@ -701,7 +609,7 @@ MetaView::calcRawMeta (Serializer& s,
{ {
auto type = &sfGeneric; auto type = &sfGeneric;
switch (it.second.mAction) switch (it.second.first)
{ {
case taaMODIFY: case taaMODIFY:
#ifdef META_DEBUG #ifdef META_DEBUG
@@ -733,7 +641,7 @@ MetaView::calcRawMeta (Serializer& s,
auto const origNode = auto const origNode =
parent_->read(keylet::unchecked(it.first)); parent_->read(keylet::unchecked(it.first));
auto curNode = it.second.mEntry; auto curNode = it.second.second;
if ((type == &sfModifiedNode) && (*curNode == *origNode)) if ((type == &sfModifiedNode) && (*curNode == *origNode))
continue; continue;
@@ -830,43 +738,4 @@ MetaView::calcRawMeta (Serializer& s,
WriteLog (lsTRACE, View) << "Metadata:" << mSet.getJson (0); 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 } // ripple

View File

@@ -18,11 +18,12 @@
//============================================================================== //==============================================================================
#include <ripple/app/ledger/tests/common_ledger.h> #include <ripple/app/ledger/tests/common_ledger.h>
#include <ripple/ledger/ViewAPI.h>
namespace ripple { namespace ripple {
namespace test { namespace test {
#if 0
class DeferredCredits_test : public beast::unit_test::suite class DeferredCredits_test : public beast::unit_test::suite
{ {
/* /*
@@ -168,11 +169,11 @@ class DeferredCredits_test : public beast::unit_test::suite
STAmount const startingAmount = STAmount const startingAmount =
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()); 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()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount + toCredit); startingAmount + toCredit);
accountSend (les, aliceAcc, gw1Acc, toDebit); accountSend (les, aliceAcc, gw1Acc, toDebit, {});
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount + toCredit - toDebit); startingAmount + toCredit - toDebit);
} }
@@ -186,11 +187,11 @@ class DeferredCredits_test : public beast::unit_test::suite
STAmount const startingAmount = STAmount const startingAmount =
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()); 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()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount + toCredit); startingAmount + toCredit);
rippleCredit (les, aliceAcc, gw1Acc, toDebit); rippleCredit (les, aliceAcc, gw1Acc, toDebit, true, {});
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount + toCredit - toDebit); startingAmount + toCredit - toDebit);
} }
@@ -204,11 +205,11 @@ class DeferredCredits_test : public beast::unit_test::suite
STAmount const startingAmount = STAmount const startingAmount =
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()); 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()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount); startingAmount);
accountSend (les, aliceAcc, gw1Acc, toDebit); accountSend (les, aliceAcc, gw1Acc, toDebit, {});
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount - toDebit); startingAmount - toDebit);
} }
@@ -222,11 +223,11 @@ class DeferredCredits_test : public beast::unit_test::suite
STAmount const startingAmount = STAmount const startingAmount =
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()); 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()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount); startingAmount);
rippleCredit (les, aliceAcc, gw1Acc, toDebit); rippleCredit (les, aliceAcc, gw1Acc, toDebit, true, {});
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount - toDebit); startingAmount - toDebit);
} }
@@ -239,7 +240,7 @@ class DeferredCredits_test : public beast::unit_test::suite
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()); accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig());
{ {
ScopedDeferCredits g (les); ScopedDeferCredits g (les);
rippleCredit (les, gw1Acc, aliceAcc, toCredit); rippleCredit (les, gw1Acc, aliceAcc, toCredit, true, {});
expect ( expect (
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount); startingAmount);
@@ -256,7 +257,7 @@ class DeferredCredits_test : public beast::unit_test::suite
les.enableDeferredCredits (); les.enableDeferredCredits ();
expect (les.areCreditsDeferred ()); expect (les.areCreditsDeferred ());
redeemIOU (les, aliceAcc, toDebit, issue); redeemIOU (les, aliceAcc, toDebit, issue, {});
expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == expect (accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount - toDebit); startingAmount - toDebit);
} }
@@ -269,7 +270,7 @@ class DeferredCredits_test : public beast::unit_test::suite
ScopedDeferCredits g (les); ScopedDeferCredits g (les);
expect (les.areCreditsDeferred ()); expect (les.areCreditsDeferred ());
issueIOU (les, aliceAcc, toCredit, issue); issueIOU (les, aliceAcc, toCredit, issue, {});
expect ( expect (
accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) == accountHolds (les, aliceAcc, usd, gw1Acc, fhIGNORE_FREEZE, getConfig()) ==
startingAmount); startingAmount);
@@ -289,5 +290,7 @@ public:
BEAST_DEFINE_TESTSUITE (DeferredCredits, ledger, ripple); BEAST_DEFINE_TESTSUITE (DeferredCredits, ledger, ripple);
#endif
} // test } // test
} // ripple } // ripple

View File

@@ -21,7 +21,6 @@
#include <ripple/test/jtx.h> #include <ripple/test/jtx.h>
#include <ripple/app/ledger/Ledger.h> #include <ripple/app/ledger/Ledger.h>
#include <ripple/app/ledger/MetaView.h> #include <ripple/app/ledger/MetaView.h>
#include <ripple/ledger/ViewAPI.h>
#include <beast/cxx14/type_traits.h> // <type_traits> #include <beast/cxx14/type_traits.h> // <type_traits>
namespace ripple { namespace ripple {

View File

@@ -31,7 +31,6 @@
#include <ripple/app/ledger/LedgerTiming.h> #include <ripple/app/ledger/LedgerTiming.h>
#include <ripple/app/ledger/LedgerToJson.h> #include <ripple/app/ledger/LedgerToJson.h>
#include <ripple/app/ledger/OrderBookDB.h> #include <ripple/app/ledger/OrderBookDB.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/app/main/LoadManager.h> #include <ripple/app/main/LoadManager.h>
#include <ripple/app/main/LocalCredentials.h> #include <ripple/app/main/LocalCredentials.h>
#include <ripple/app/misc/IHashRouter.h> #include <ripple/app/misc/IHashRouter.h>

View File

@@ -27,8 +27,9 @@ namespace ripple {
// VFALCO TODO de-inline these function definitions // VFALCO TODO de-inline these function definitions
class NodeDirectory { class NodeDirectory
public: {
public:
// Current directory - the last 64 bits of this are the quality. // Current directory - the last 64 bits of this are the quality.
uint256 current; uint256 current;
@@ -52,7 +53,7 @@ class NodeDirectory {
restartNeeded = true; // Restart at same quality. restartNeeded = true; // Restart at same quality.
} }
bool initialize (Book const& book, MetaView& les) bool initialize (Book const& book, View& view)
{ {
if (current != zero) if (current != zero)
return false; return false;
@@ -63,19 +64,28 @@ class NodeDirectory {
// TODO(tom): it seems impossible that any actual offers with // TODO(tom): it seems impossible that any actual offers with
// quality == 0 could occur - we should disallow them, and clear // quality == 0 could occur - we should disallow them, and clear
// directory.ledgerEntry without the database call in the next line. // 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 // Advance, if didn't find it. Normal not to be unable to lookup
// firstdirectory. Maybe even skip this lookup. // firstdirectory. Maybe even skip this lookup.
advanceNeeded = !ledgerEntry; advanceNeeded = ! ledgerEntry;
restartNeeded = false; restartNeeded = false;
// Associated vars are dirty, if found it. // Associated vars are dirty, if found it.
return bool(ledgerEntry); return bool(ledgerEntry);
} }
enum Advance {NO_ADVANCE, NEW_QUALITY, END_ADVANCE}; enum Advance
Advance advance(MetaView& les) {
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)) if (!(advanceNeeded || restartNeeded))
return NO_ADVANCE; return NO_ADVANCE;
@@ -86,7 +96,7 @@ class NodeDirectory {
if (advanceNeeded) if (advanceNeeded)
{ {
auto const opt = auto const opt =
les.succ (current, next); view.succ (current, next);
current = opt ? *opt : uint256{}; current = opt ? *opt : uint256{};
} }
advanceNeeded = false; advanceNeeded = false;
@@ -95,7 +105,7 @@ class NodeDirectory {
if (current == zero) if (current == zero)
return END_ADVANCE; return END_ADVANCE;
ledgerEntry = les.peek (keylet::page(current)); ledgerEntry = view.peek (keylet::page(current));
return NEW_QUALITY; return NEW_QUALITY;
} }
}; };

View File

@@ -483,8 +483,9 @@ Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
if (valid) if (valid)
{ {
MetaView sandbox( boost::optional<PaymentView> sandbox;
cache->getLedger(), tapNONE); sandbox.emplace(cache->getLedger(), tapNONE);
auto& sourceAccount = !isXRP (currIssuer.account) auto& sourceAccount = !isXRP (currIssuer.account)
? currIssuer.account ? currIssuer.account
: isXRP (currIssuer.currency) : isXRP (currIssuer.currency)
@@ -496,7 +497,7 @@ Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
m_journal.debug << iIdentifier m_journal.debug << iIdentifier
<< " Paths found, calling rippleCalc"; << " Paths found, calling rippleCalc";
auto rc = path::RippleCalc::rippleCalculate ( auto rc = path::RippleCalc::rippleCalculate (
sandbox, *sandbox,
saMaxAmount, saMaxAmount,
saDstAmount, saDstAmount,
*raDstAccount, *raDstAccount,
@@ -509,9 +510,9 @@ Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
m_journal.debug m_journal.debug
<< iIdentifier << " Trying with an extra path element"; << iIdentifier << " Trying with an extra path element";
spsPaths.push_back (fullLiquidityPath); spsPaths.push_back (fullLiquidityPath);
reconstruct(sandbox, cache->getLedger (), tapNONE); sandbox.emplace(cache->getLedger (), tapNONE);
rc = path::RippleCalc::rippleCalculate ( rc = path::RippleCalc::rippleCalculate (
sandbox, *sandbox,
saMaxAmount, saMaxAmount,
saDstAmount, saDstAmount,
*raDstAccount, *raDstAccount,

View File

@@ -268,7 +268,7 @@ TER PathState::pushNode (
auto const& backNode = nodes_.back (); auto const& backNode = nodes_.back ();
if (backNode.isAccount()) if (backNode.isAccount())
{ {
auto sleRippleState = metaView_.peek( auto sleRippleState = view().peek(
keylet::line(backNode.account_, node.account_, backNode.issue_.currency)); keylet::line(backNode.account_, node.account_, backNode.issue_.currency));
// A "RippleState" means a balance betweeen two accounts for a // A "RippleState" means a balance betweeen two accounts for a
@@ -291,7 +291,7 @@ TER PathState::pushNode (
<< backNode.account_ << " and " << node.account_ << backNode.account_ << " and " << node.account_
<< " for " << node.issue_.currency << "." ; << " for " << node.issue_.currency << "." ;
auto sleBck = metaView_.peek ( auto sleBck = view().peek (
keylet::account(backNode.account_)); keylet::account(backNode.account_));
// Is the source account the highest numbered account ID? // Is the source account the highest numbered account ID?
bool bHigh = backNode.account_ > node.account_; bool bHigh = backNode.account_ > node.account_;
@@ -318,13 +318,13 @@ TER PathState::pushNode (
if (resultCode == tesSUCCESS) if (resultCode == tesSUCCESS)
{ {
STAmount saOwed = creditBalance (metaView_, STAmount saOwed = creditBalance (view(),
node.account_, backNode.account_, node.account_, backNode.account_,
node.issue_.currency); node.issue_.currency);
STAmount saLimit; STAmount saLimit;
if (saOwed <= zero) { if (saOwed <= zero) {
saLimit = creditLimit (metaView_, saLimit = creditLimit (view(),
node.account_, node.account_,
backNode.account_, backNode.account_,
node.issue_.currency); node.issue_.currency);
@@ -624,7 +624,7 @@ void PathState::checkFreeze()
// Check each order book for a global freeze // Check each order book for a global freeze
if (nodes_[i].uFlags & STPathElement::typeIssuer) 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)) if (sle && sle->isFlag (lsfGlobalFreeze))
{ {
@@ -642,7 +642,7 @@ void PathState::checkFreeze()
if (inAccount != outAccount) if (inAccount != outAccount)
{ {
sle = metaView_.peek (keylet::account(outAccount)); sle = view().peek (keylet::account(outAccount));
if (sle && sle->isFlag (lsfGlobalFreeze)) if (sle && sle->isFlag (lsfGlobalFreeze))
{ {
@@ -650,7 +650,7 @@ void PathState::checkFreeze()
return; return;
} }
sle = metaView_.peek (keylet::line(inAccount, sle = view().peek (keylet::line(inAccount,
outAccount, currencyID)); outAccount, currencyID));
if (sle && sle->isFlag ( if (sle && sle->isFlag (
@@ -677,9 +677,9 @@ TER PathState::checkNoRipple (
Currency const& currency) Currency const& currency)
{ {
// fetch the ripple lines into and out of this node // 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)); keylet::line(firstAccount, secondAccount, currency));
SLE::pointer sleOut = metaView_.peek ( SLE::pointer sleOut = view().peek (
keylet::line(secondAccount, thirdAccount, currency)); keylet::line(secondAccount, thirdAccount, currency));
if (!sleIn || !sleOut) if (!sleIn || !sleOut)

View File

@@ -23,6 +23,7 @@
#include <ripple/app/ledger/MetaView.h> #include <ripple/app/ledger/MetaView.h>
#include <ripple/app/paths/Node.h> #include <ripple/app/paths/Node.h>
#include <ripple/app/paths/Types.h> #include <ripple/app/paths/Types.h>
#include <ripple/app/paths/impl/PaymentView.h>
#include <boost/optional.hpp> #include <boost/optional.hpp>
namespace ripple { namespace ripple {
@@ -35,13 +36,15 @@ class PathState : public CountedObject <PathState>
using Ptr = std::shared_ptr<PathState>; using Ptr = std::shared_ptr<PathState>;
using List = std::vector<Ptr>; using List = std::vector<Ptr>;
PathState (MetaView& view, STAmount const& saSend, STAmount const& saSendMax) PathState (PaymentView& parent,
: metaView_ (view) STAmount const& saSend,
, mIndex (0) STAmount const& saSendMax)
: mIndex (0)
, uQuality (0) , uQuality (0)
, saInReq (saSendMax) , saInReq (saSendMax)
, saOutReq (saSend) , saOutReq (saSend)
{ {
view_.emplace(&parent);
} }
void reset(STAmount const& in, STAmount const& out); 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); 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 bool isDry() const
@@ -136,23 +140,8 @@ private:
Json::Value getJson () const; Json::Value getJson () const;
TER terStatus; private:
path::Node::List nodes_; boost::optional<PaymentView> view_;
// 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_;
int mIndex; // Index/rank amoung siblings. int mIndex; // Index/rank amoung siblings.
std::uint64_t uQuality; // 0 = no quality/liquity left. std::uint64_t uQuality; // 0 = no quality/liquity left.
@@ -167,6 +156,23 @@ private:
// If true, all liquidity on this path has been consumed. // If true, all liquidity on this path has been consumed.
bool allLiquidityConsumed_ = false; 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 } // ripple

View File

@@ -23,6 +23,7 @@
#include <ripple/app/paths/Pathfinder.h> #include <ripple/app/paths/Pathfinder.h>
#include <ripple/app/paths/RippleCalc.h> #include <ripple/app/paths/RippleCalc.h>
#include <ripple/app/paths/RippleLineCache.h> #include <ripple/app/paths/RippleLineCache.h>
#include <ripple/app/paths/impl/PaymentView.h>
#include <ripple/app/ledger/OrderBookDB.h> #include <ripple/app/ledger/OrderBookDB.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/json/to_string.h> #include <ripple/json/to_string.h>
@@ -377,7 +378,7 @@ TER Pathfinder::getPathLiquidity (
path::RippleCalc::Input rcInput; path::RippleCalc::Input rcInput;
rcInput.defaultPathsAllowed = false; rcInput.defaultPathsAllowed = false;
MetaView sandbox (mLedger, tapNONE); PaymentView sandbox (mLedger, tapNONE);
try try
{ {
@@ -442,7 +443,7 @@ void Pathfinder::computePathRanks (int maxPaths)
// Must subtract liquidity in default path from remaining amount. // Must subtract liquidity in default path from remaining amount.
try try
{ {
MetaView sandbox (mLedger, tapNONE); PaymentView sandbox (mLedger, tapNONE);
path::RippleCalc::Input rcInput; path::RippleCalc::Input rcInput;
rcInput.partialPaymentAllowed = true; rcInput.partialPaymentAllowed = true;

View File

@@ -21,7 +21,6 @@
#include <ripple/app/paths/Tuning.h> #include <ripple/app/paths/Tuning.h>
#include <ripple/app/paths/RippleCalc.h> #include <ripple/app/paths/RippleCalc.h>
#include <ripple/app/paths/cursor/PathCursor.h> #include <ripple/app/paths/cursor/PathCursor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
namespace ripple { namespace ripple {
@@ -44,7 +43,7 @@ deleteOffers (View& view,
} // namespace } // namespace
RippleCalc::Output RippleCalc::rippleCalculate ( RippleCalc::Output RippleCalc::rippleCalculate (
MetaView& activeLedger, PaymentView& view,
// Compute paths using this ledger entry set. Up to caller to actually // Compute paths using this ledger entry set. Up to caller to actually
// apply to ledger. // apply to ledger.
@@ -70,7 +69,7 @@ RippleCalc::Output RippleCalc::rippleCalculate (
Input const* const pInputs) Input const* const pInputs)
{ {
RippleCalc rc ( RippleCalc rc (
activeLedger, view,
saMaxAmountReq, saMaxAmountReq,
saDstAmountReq, saDstAmountReq,
uDstAccountID, uDstAccountID,
@@ -94,7 +93,7 @@ RippleCalc::Output RippleCalc::rippleCalculate (
bool RippleCalc::addPathState(STPath const& path, TER& resultCode) bool RippleCalc::addPathState(STPath const& path, TER& resultCode)
{ {
auto pathState = std::make_shared<PathState> ( auto pathState = std::make_shared<PathState> (
metaView, saDstAmountReq_, saMaxAmountReq_); view, saDstAmountReq_, saMaxAmountReq_);
if (!pathState) if (!pathState)
{ {
@@ -145,7 +144,6 @@ bool RippleCalc::addPathState(STPath const& path, TER& resultCode)
// <-- TER: Only returns tepPATH_PARTIAL if partialPaymentAllowed. // <-- TER: Only returns tepPATH_PARTIAL if partialPaymentAllowed.
TER RippleCalc::rippleCalculate () TER RippleCalc::rippleCalculate ()
{ {
assert (metaView.isValid ());
WriteLog (lsTRACE, RippleCalc) WriteLog (lsTRACE, RippleCalc)
<< "rippleCalc>" << "rippleCalc>"
<< " saMaxAmountReq_:" << saMaxAmountReq_ << " saMaxAmountReq_:" << saMaxAmountReq_
@@ -330,9 +328,8 @@ TER RippleCalc::rippleCalculate ()
pathState->unfundedOffers().begin (), pathState->unfundedOffers().begin (),
pathState->unfundedOffers().end ()); pathState->unfundedOffers().end ());
// Apply best pass' MetaView // Apply best pass' view
assert (pathState->metaView().isValid ()); pathState->view().apply();
pathState->metaView().apply();
actualAmountIn_ += pathState->inPass(); actualAmountIn_ += pathState->inPass();
actualAmountOut_ += pathState->outPass(); actualAmountOut_ += pathState->outPass();
@@ -414,9 +411,9 @@ TER RippleCalc::rippleCalculate ()
if (resultCode == tesSUCCESS) if (resultCode == tesSUCCESS)
{ {
resultCode = deleteOffers(metaView, unfundedOffersFromBestPaths); resultCode = deleteOffers(view, unfundedOffersFromBestPaths);
if (resultCode == tesSUCCESS) if (resultCode == tesSUCCESS)
resultCode = deleteOffers(metaView, permanentlyUnfundedOffers_); resultCode = deleteOffers(view, permanentlyUnfundedOffers_);
} }
// If isOpenLedger, then ledger is not final, can vote no. // If isOpenLedger, then ledger is not final, can vote no.

View File

@@ -20,7 +20,7 @@
#ifndef RIPPLE_APP_PATHS_RIPPLECALC_H_INCLUDED #ifndef RIPPLE_APP_PATHS_RIPPLECALC_H_INCLUDED
#define 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/app/paths/PathState.h>
#include <ripple/protocol/STAmount.h> #include <ripple/protocol/STAmount.h>
#include <ripple/protocol/TER.h> #include <ripple/protocol/TER.h>
@@ -72,8 +72,10 @@ public:
}; };
static Output rippleCalculate ( static
MetaView& activeLedger, Output
rippleCalculate(
PaymentView& view,
// Compute paths using this ledger entry set. Up to caller to actually // Compute paths using this ledger entry set. Up to caller to actually
// apply to ledger. // apply to ledger.
@@ -99,8 +101,7 @@ public:
Input const* const pInputs = nullptr); Input const* const pInputs = nullptr);
// The view we are currently working on // The view we are currently working on
MetaView& metaView; PaymentView& view;
// If the transaction fails to meet some constraint, still need to delete // If the transaction fails to meet some constraint, still need to delete
// unfunded offers. // unfunded offers.
@@ -116,14 +117,14 @@ public:
private: private:
RippleCalc ( RippleCalc (
MetaView& activeLedger, PaymentView& view_,
STAmount const& saMaxAmountReq, // --> -1 = no limit. STAmount const& saMaxAmountReq, // --> -1 = no limit.
STAmount const& saDstAmountReq, STAmount const& saDstAmountReq,
AccountID const& uDstAccountID, AccountID const& uDstAccountID,
AccountID const& uSrcAccountID, AccountID const& uSrcAccountID,
STPathSet const& spsPaths) STPathSet const& spsPaths)
: metaView (activeLedger), : view (view_),
saDstAmountReq_(saDstAmountReq), saDstAmountReq_(saDstAmountReq),
saMaxAmountReq_(saMaxAmountReq), saMaxAmountReq_(saMaxAmountReq),
uDstAccountID_(uDstAccountID), uDstAccountID_(uDstAccountID),

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/paths/RippleState.h> #include <ripple/app/paths/RippleState.h>
#include <ripple/protocol/STAmount.h> #include <ripple/protocol/STAmount.h>

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/cursor/RippleLiquidity.h> #include <ripple/app/paths/cursor/RippleLiquidity.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
namespace ripple { namespace ripple {
@@ -68,10 +67,10 @@ TER PathCursor::advanceNode (bool const bReverse) const
} }
bool bDirectDirDirty = node().directory.initialize ( bool bDirectDirDirty = node().directory.initialize (
{previousNode().issue_, node().issue_}, { previousNode().issue_, node().issue_},
ledger()); view());
if (auto advance = node().directory.advance (ledger())) if (auto advance = node().directory.advance (view()))
{ {
bDirectDirDirty = true; bDirectDirDirty = true;
if (advance == NodeDirectory::NEW_QUALITY) if (advance == NodeDirectory::NEW_QUALITY)
@@ -129,7 +128,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
= node().sleOffer->getFieldAmount (sfTakerGets); = node().sleOffer->getFieldAmount (sfTakerGets);
// Funds left. // Funds left.
node().saOfferFunds = accountFunds (ledger(), node().saOfferFunds = accountFunds(view(),
node().offerOwnerAccount_, node().offerOwnerAccount_,
node().saTakerGets, node().saTakerGets,
fhZERO_IF_FROZEN, fhZERO_IF_FROZEN,
@@ -145,7 +144,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
WriteLog (lsTRACE, RippleCalc) << "advanceNode: as is"; WriteLog (lsTRACE, RippleCalc) << "advanceNode: as is";
} }
} }
else if (!dirNext (ledger(), else if (!dirNext (view(),
node().directory.current, node().directory.current,
node().directory.ledgerEntry, node().directory.ledgerEntry,
node().uEntry, node().uEntry,
@@ -182,7 +181,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
else else
{ {
// Got a new offer. // Got a new offer.
node().sleOffer = ledger().peek (keylet::offer(node().offerIndex_)); node().sleOffer = view().peek (keylet::offer(node().offerIndex_));
if (!node().sleOffer) if (!node().sleOffer)
{ {
@@ -213,7 +212,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
if (node().sleOffer->isFieldPresent (sfExpiration) && if (node().sleOffer->isFieldPresent (sfExpiration) &&
(node().sleOffer->getFieldU32 (sfExpiration) <= (node().sleOffer->getFieldU32 (sfExpiration) <=
getParentCloseTimeNC(ledger()))) getParentCloseTimeNC(view())))
{ {
// Offer is expired. // Offer is expired.
WriteLog (lsTRACE, RippleCalc) WriteLog (lsTRACE, RippleCalc)
@@ -329,7 +328,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
// Only the current node is allowed to use the source. // Only the current node is allowed to use the source.
node().saOfferFunds = accountFunds(ledger(), node().saOfferFunds = accountFunds(view(),
node().offerOwnerAccount_, node().offerOwnerAccount_,
node().saTakerGets, node().saTakerGets,
fhZERO_IF_FROZEN, fhZERO_IF_FROZEN,

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/cursor/RippleLiquidity.h> #include <ripple/app/paths/cursor/RippleLiquidity.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
namespace ripple { namespace ripple {
@@ -196,7 +195,7 @@ TER PathCursor::deliverNodeForward (
// Output: Debit offer owner, send XRP or non-XPR to next // Output: Debit offer owner, send XRP or non-XPR to next
// account. // account.
resultCode = accountSend (ledger(), resultCode = accountSend(view(),
node().offerOwnerAccount_, node().offerOwnerAccount_,
nextNode().account_, nextNode().account_,
saOutPassAct); saOutPassAct);
@@ -253,7 +252,7 @@ TER PathCursor::deliverNodeForward (
auto const& id = isXRP(node().issue_) ? auto const& id = isXRP(node().issue_) ?
xrpAccount() : node().issue_.account; xrpAccount() : node().issue_.account;
auto outPassTotal = saOutPassAct + saOutPassFees; auto outPassTotal = saOutPassAct + saOutPassFees;
accountSend (ledger(), accountSend(view(),
node().offerOwnerAccount_, node().offerOwnerAccount_,
id, id,
outPassTotal); outPassTotal);
@@ -287,7 +286,7 @@ TER PathCursor::deliverNodeForward (
{ {
auto id = !isXRP(previousNode().issue_.currency) ? auto id = !isXRP(previousNode().issue_.currency) ?
uInAccountID : xrpAccount(); uInAccountID : xrpAccount();
resultCode = accountSend (ledger(), resultCode = accountSend(view(),
id, id,
node().offerOwnerAccount_, node().offerOwnerAccount_,
saInPassAct); saInPassAct);
@@ -317,7 +316,7 @@ TER PathCursor::deliverNodeForward (
node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew); node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew);
node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew); node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew);
ledger().update (node().sleOffer); view().update (node().sleOffer);
if (saOutPassAct == saOutFunded || saTakerGetsNew == zero) if (saOutPassAct == saOutFunded || saTakerGetsNew == zero)
{ {

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/cursor/RippleLiquidity.h> #include <ripple/app/paths/cursor/RippleLiquidity.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
namespace ripple { namespace ripple {
@@ -280,7 +279,7 @@ TER PathCursor::deliverNodeReverse (
// visited. However, these deductions and adjustments are tenative. // visited. However, these deductions and adjustments are tenative.
// //
// Must reset balances when going forward to perform actual transfers. // Must reset balances when going forward to perform actual transfers.
resultCode = accountSend (ledger(), resultCode = accountSend(view(),
node().offerOwnerAccount_, node().issue_.account, saOutPassAct); node().offerOwnerAccount_, node().issue_.account, saOutPassAct);
if (resultCode != tesSUCCESS) if (resultCode != tesSUCCESS)
@@ -304,7 +303,7 @@ TER PathCursor::deliverNodeReverse (
node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew); node().sleOffer->setFieldAmount (sfTakerGets, saTakerGetsNew);
node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew); node().sleOffer->setFieldAmount (sfTakerPays, saTakerPaysNew);
ledger().update (node().sleOffer); view().update (node().sleOffer);
if (saOutPassAct == node().saTakerGets) if (saOutPassAct == node().saTakerGets)
{ {

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/cursor/RippleLiquidity.h> #include <ripple/app/paths/cursor/RippleLiquidity.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/Quality.h> #include <ripple/protocol/Quality.h>
@@ -56,13 +55,13 @@ TER PathCursor::forwardLiquidityForAccount () const
nextNode().isAccount() ? nextNode().account_ : node().account_; nextNode().isAccount() ? nextNode().account_ : node().account_;
std::uint32_t uQualityIn = nodeIndex_ std::uint32_t uQualityIn = nodeIndex_
? quality_in (ledger(), ? quality_in (view(),
node().account_, node().account_,
previousAccountID, previousAccountID,
node().issue_.currency) node().issue_.currency)
: QUALITY_ONE; : QUALITY_ONE;
std::uint32_t uQualityOut = (nodeIndex_ == lastNodeIndex) std::uint32_t uQualityOut = (nodeIndex_ == lastNodeIndex)
? quality_out (ledger(), ? quality_out (view(),
node().account_, node().account_,
nextAccountID, nextAccountID,
node().issue_.currency) node().issue_.currency)
@@ -167,7 +166,7 @@ TER PathCursor::forwardLiquidityForAccount () const
if (saCurReceive) if (saCurReceive)
{ {
// Actually receive. // Actually receive.
resultCode = rippleCredit (ledger(), resultCode = rippleCredit(view(),
previousAccountID, previousAccountID,
node().account_, node().account_,
previousNode().saFwdRedeem + previousNode().saFwdIssue, previousNode().saFwdRedeem + previousNode().saFwdIssue,
@@ -235,7 +234,7 @@ TER PathCursor::forwardLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
previousNode().saFwdRedeem, previousNode().saFwdRedeem,
node().saRevIssue, node().saRevIssue,
saPrvRedeemAct, saPrvRedeemAct,
@@ -267,7 +266,7 @@ TER PathCursor::forwardLiquidityForAccount () const
// Adjust prv --> cur balance : take all inbound // Adjust prv --> cur balance : take all inbound
resultCode = saProvide resultCode = saProvide
? rippleCredit (ledger(), ? rippleCredit(view(),
previousAccountID, previousAccountID,
node().account_, node().account_,
previousNode().saFwdRedeem + previousNode().saFwdIssue, previousNode().saFwdRedeem + previousNode().saFwdIssue,
@@ -304,7 +303,7 @@ TER PathCursor::forwardLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
previousNode().saFwdRedeem, previousNode().saFwdRedeem,
node().saRevDeliver, node().saRevDeliver,
saPrvRedeemAct, saPrvRedeemAct,
@@ -332,7 +331,7 @@ TER PathCursor::forwardLiquidityForAccount () const
// Adjust prv --> cur balance : take all inbound // Adjust prv --> cur balance : take all inbound
resultCode = node().saFwdDeliver resultCode = node().saFwdDeliver
? rippleCredit (ledger(), ? rippleCredit(view(),
previousAccountID, node().account_, previousAccountID, node().account_,
previousNode().saFwdRedeem + previousNode().saFwdIssue, previousNode().saFwdRedeem + previousNode().saFwdIssue,
false) false)
@@ -354,7 +353,7 @@ TER PathCursor::forwardLiquidityForAccount () const
if (isXRP (node().issue_)) if (isXRP (node().issue_))
node().saFwdDeliver = std::min ( node().saFwdDeliver = std::min (
node().saFwdDeliver, node().saFwdDeliver,
accountHolds (ledger(), accountHolds(view(),
node().account_, node().account_,
xrpCurrency(), xrpCurrency(),
xrpAccount(), xrpAccount(),
@@ -391,7 +390,7 @@ TER PathCursor::forwardLiquidityForAccount () const
<< "ACCOUNT -- XRP --> offer"; << "ACCOUNT -- XRP --> offer";
// Deliver XRP to limbo. // Deliver XRP to limbo.
resultCode = accountSend (ledger(), resultCode = accountSend(view(),
node().account_, xrpAccount(), node().saFwdDeliver); node().account_, xrpAccount(), node().saFwdDeliver);
} }
} }
@@ -451,7 +450,7 @@ TER PathCursor::forwardLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
previousNode().saFwdDeliver, previousNode().saFwdDeliver,
node().saRevIssue, node().saRevIssue,
saPrvDeliverAct, saPrvDeliverAct,
@@ -482,7 +481,7 @@ TER PathCursor::forwardLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
previousNode().saFwdDeliver, previousNode().saFwdDeliver,
node().saRevDeliver, node().saRevDeliver,
saPrvDeliverAct, saPrvDeliverAct,

View File

@@ -30,7 +30,7 @@ TER PathCursor::liquidity () const
TER resultCode = tecPATH_DRY; TER resultCode = tecPATH_DRY;
PathCursor pc = *this; PathCursor pc = *this;
pathState_.resetView (rippleCalc_.metaView); pathState_.resetView (rippleCalc_.view);
for (pc.nodeIndex_ = pc.nodeSize(); pc.nodeIndex_--; ) for (pc.nodeIndex_ = pc.nodeSize(); pc.nodeIndex_--; )
{ {
@@ -59,7 +59,7 @@ TER PathCursor::liquidity () const
if (resultCode != tesSUCCESS) if (resultCode != tesSUCCESS)
return resultCode; return resultCode;
pathState_.resetView (rippleCalc_.metaView); pathState_.resetView (rippleCalc_.view);
for (pc.nodeIndex_ = 0; pc.nodeIndex_ < pc.nodeSize(); ++pc.nodeIndex_) for (pc.nodeIndex_ = 0; pc.nodeIndex_ < pc.nodeSize(); ++pc.nodeIndex_)
{ {

View File

@@ -92,11 +92,10 @@ private:
STAmount& saInFees) const; STAmount& saInFees) const;
// VFALCO TODO Rename this to view() // VFALCO TODO Rename this to view()
MetaView& ledger() const PaymentView&
view() const
{ {
// VFALCO Rename metaView to view return pathState_.view();
//return rippleCalc_.metaView;
return pathState_.metaView();
} }
NodeIndex nodeSize() const NodeIndex nodeSize() const

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/cursor/PathCursor.h> #include <ripple/app/paths/cursor/PathCursor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <tuple> #include <tuple>
@@ -57,7 +56,7 @@ TER PathCursor::reverseLiquidity () const
// node.transferRate_ caches the output transfer rate for this node. // node.transferRate_ caches the output transfer rate for this node.
node().transferRate_ = amountFromRate ( node().transferRate_ = amountFromRate (
rippleTransferRate (ledger(), node().issue_.account)); rippleTransferRate (view(), node().issue_.account));
if (node().isAccount ()) if (node().isAccount ())
return reverseLiquidityForAccount (); return reverseLiquidityForAccount ();

View File

@@ -20,7 +20,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/Credit.h> #include <ripple/app/paths/Credit.h>
#include <ripple/app/paths/cursor/RippleLiquidity.h> #include <ripple/app/paths/cursor/RippleLiquidity.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/Quality.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. // This is the quality from from the previous node to this one.
const std::uint32_t uQualityIn const std::uint32_t uQualityIn
= (nodeIndex_ != 0) = (nodeIndex_ != 0)
? quality_in (ledger(), ? quality_in (view(),
node().account_, node().account_,
previousAccountID, previousAccountID,
node().issue_.currency) node().issue_.currency)
@@ -75,7 +74,7 @@ TER PathCursor::reverseLiquidityForAccount () const
// And this is the quality from the next one to this one. // And this is the quality from the next one to this one.
const std::uint32_t uQualityOut const std::uint32_t uQualityOut
= (nodeIndex_ != lastNodeIndex) = (nodeIndex_ != lastNodeIndex)
? quality_out (ledger(), ? quality_out (view(),
node().account_, node().account_,
nextAccountID, nextAccountID,
node().issue_.currency) node().issue_.currency)
@@ -84,7 +83,7 @@ TER PathCursor::reverseLiquidityForAccount () const
// For previousNodeIsAccount: // For previousNodeIsAccount:
// Previous account is already owed. // Previous account is already owed.
const STAmount saPrvOwed = (previousNodeIsAccount && nodeIndex_ != 0) const STAmount saPrvOwed = (previousNodeIsAccount && nodeIndex_ != 0)
? creditBalance (ledger(), ? creditBalance (view(),
node().account_, node().account_,
previousAccountID, previousAccountID,
node().issue_.currency) node().issue_.currency)
@@ -92,7 +91,7 @@ TER PathCursor::reverseLiquidityForAccount () const
// The limit amount that the previous account may owe. // The limit amount that the previous account may owe.
const STAmount saPrvLimit = (previousNodeIsAccount && nodeIndex_ != 0) const STAmount saPrvLimit = (previousNodeIsAccount && nodeIndex_ != 0)
? creditLimit (ledger(), ? creditLimit (view(),
node().account_, node().account_,
previousAccountID, previousAccountID,
node().issue_.currency) node().issue_.currency)
@@ -100,7 +99,7 @@ TER PathCursor::reverseLiquidityForAccount () const
// Next account is owed. // Next account is owed.
const STAmount saNxtOwed = (nextNodeIsAccount && nodeIndex_ != lastNodeIndex) const STAmount saNxtOwed = (nextNodeIsAccount && nodeIndex_ != lastNodeIndex)
? creditBalance (ledger(), ? creditBalance (view(),
node().account_, node().account_,
nextAccountID, nextAccountID,
node().issue_.currency) node().issue_.currency)
@@ -318,7 +317,7 @@ TER PathCursor::reverseLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
saPrvRedeemReq, saPrvRedeemReq,
node().saRevIssue, node().saRevIssue,
previousNode().saRevRedeem, previousNode().saRevRedeem,
@@ -404,7 +403,7 @@ TER PathCursor::reverseLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
saPrvRedeemReq, saPrvRedeemReq,
node().saRevDeliver, node().saRevDeliver,
previousNode().saRevRedeem, previousNode().saRevRedeem,
@@ -553,7 +552,7 @@ TER PathCursor::reverseLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
saPrvDeliverReq, saPrvDeliverReq,
node().saRevIssue, node().saRevIssue,
previousNode().saRevDeliver, previousNode().saRevDeliver,
@@ -586,7 +585,7 @@ TER PathCursor::reverseLiquidityForAccount () const
rippleLiquidity ( rippleLiquidity (
rippleCalc_, rippleCalc_,
QUALITY_ONE, QUALITY_ONE,
rippleTransferRate (ledger(), node().account_), rippleTransferRate (view(), node().account_),
saPrvDeliverReq, saPrvDeliverReq,
node().saRevDeliver, node().saRevDeliver,
previousNode().saRevDeliver, previousNode().saRevDeliver,

View 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

View File

@@ -18,28 +18,61 @@
//============================================================================== //==============================================================================
#ifndef RIPPLE_APP_PAYMENTVIEW_H_INCLUDED #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/View.h>
#include <ripple/ledger/ViewAPIBasics.h>
#include <ripple/ledger/DeferredCredits.h> #include <ripple/ledger/DeferredCredits.h>
#include <utility>
namespace ripple { namespace ripple {
/** A View wrapper which makes credits unavailable to balances. /** A View wrapper which makes credits unavailable to balances.
This is used for payments, so that consuming liquidity This is used for payments and pathfinding, so that consuming
from a path never causes portions of that path or other liquidity from a path never causes portions of that path or
paths to gain liquidity. 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 class PaymentView : public View
{ {
private: private:
View& view_; MetaView view_;
DeferredCredits tab_; DeferredCredits tab_;
PaymentView* pv_ = nullptr;
public: public:
PaymentView (PaymentView const&) = delete;
PaymentView& operator= (PaymentView const&) = delete;
/** Construct contained MetaView from arguments */
template <class... Args>
explicit explicit
PaymentView (View& view) PaymentView (Args&&... args)
: view_(view) : 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_; 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> std::shared_ptr<SLE>
@@ -132,14 +156,20 @@ public:
return view_.openLedger(); return view_.openLedger();
} }
// Unfortunately necessary for DeferredCredits //--------------------------------------------------------------------------
STAmount
balanceHook (AccountID const& account,
AccountID const& issuer,
STAmount const& amount) const override;
void void
deprecatedCreditHint (AccountID const& from, creditHook (AccountID const& from,
AccountID const& to, AccountID const& to,
STAmount const& amount) override STAmount const& amount) override;
{
tab_.credit(from, to, amount); void
} apply();
}; };
} // ripple } // ripple

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/BookTip.h> #include <ripple/app/tx/impl/BookTip.h>
#include <ripple/ledger/ViewAPI.h>
namespace ripple { namespace ripple {

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/Indexes.h> #include <ripple/protocol/Indexes.h>
#include <ripple/protocol/TxFlags.h> #include <ripple/protocol/TxFlags.h>

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/Indexes.h> #include <ripple/protocol/Indexes.h>

View File

@@ -21,7 +21,6 @@
#include <ripple/app/tx/impl/OfferStream.h> #include <ripple/app/tx/impl/OfferStream.h>
#include <ripple/app/tx/impl/Taker.h> #include <ripple/app/tx/impl/Taker.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/protocol/Quality.h> #include <ripple/protocol/Quality.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/json/to_string.h> #include <ripple/json/to_string.h>

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/Indexes.h> #include <ripple/protocol/Indexes.h>

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/OfferStream.h> #include <ripple/app/tx/impl/OfferStream.h>
#include <ripple/ledger/ViewAPI.h>
namespace ripple { namespace ripple {

View File

@@ -20,7 +20,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/paths/RippleCalc.h> #include <ripple/app/paths/RippleCalc.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/app/tx/impl/PaymentView.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/TxFlags.h> #include <ripple/protocol/TxFlags.h>
@@ -295,15 +294,19 @@ public:
{ {
path::RippleCalc::Output rc; path::RippleCalc::Output rc;
{ {
ScopedDeferCredits g (mEngine->view ()); PaymentView view (mEngine->view());
rc = path::RippleCalc::rippleCalculate ( rc = path::RippleCalc::rippleCalculate (
mEngine->view (), view,
maxSourceAmount, maxSourceAmount,
saDstAmount, saDstAmount,
uDstAccountID, uDstAccountID,
mTxnAccountID, mTxnAccountID,
spsPaths, spsPaths,
&rcInput); &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 // TODO: is this right? If the amount is the correct amount, was

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/core/Config.h> #include <ripple/core/Config.h>
#include <ripple/protocol/Indexes.h> #include <ripple/protocol/Indexes.h>

View File

@@ -20,7 +20,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/app/tx/impl/SignerEntries.h> #include <ripple/app/tx/impl/SignerEntries.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/protocol/STObject.h> #include <ripple/protocol/STObject.h>
#include <ripple/protocol/STArray.h> #include <ripple/protocol/STArray.h>
#include <ripple/protocol/STTx.h> #include <ripple/protocol/STTx.h>

View File

@@ -20,7 +20,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/protocol/Quality.h> #include <ripple/protocol/Quality.h>
#include <ripple/app/tx/impl/Transactor.h> #include <ripple/app/tx/impl/Transactor.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/protocol/Indexes.h> #include <ripple/protocol/Indexes.h>
#include <ripple/protocol/TxFlags.h> #include <ripple/protocol/TxFlags.h>

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/tx/impl/Taker.h> #include <ripple/app/tx/impl/Taker.h>
#include <ripple/ledger/ViewAPI.h>
namespace ripple { namespace ripple {

View File

@@ -22,7 +22,6 @@
#include <ripple/app/ledger/Ledger.h> #include <ripple/app/ledger/Ledger.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/test/jtx.h> #include <ripple/test/jtx.h>
#include <ripple/test/jtx/Account.h> #include <ripple/test/jtx/Account.h>

View File

@@ -19,7 +19,6 @@
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/app/ledger/LedgerConsensus.h> #include <ripple/app/ledger/LedgerConsensus.h>
#include <ripple/app/ledger/LedgerTiming.h> #include <ripple/app/ledger/LedgerTiming.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/app/ledger/tests/common_ledger.h> #include <ripple/app/ledger/tests/common_ledger.h>
#include <ripple/basics/seconds_clock.h> #include <ripple/basics/seconds_clock.h>
#include <ripple/protocol/TxFormats.h> #include <ripple/protocol/TxFormats.h>

View File

@@ -58,8 +58,12 @@ public:
AccountID const& receiver, AccountID const& receiver,
STAmount const& amount); 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 begin() { return map_.begin(); }
std::map<Key, Value>::iterator end() { return map_.end(); } std::map<Key, Value>::iterator end() { return map_.end(); }
void merge (std::pair <Key, Value> const& p); void merge (std::pair <Key, Value> const& p);

View File

@@ -21,6 +21,11 @@
#define RIPPLE_LEDGER_VIEW_H_INCLUDED #define RIPPLE_LEDGER_VIEW_H_INCLUDED
#include <ripple/protocol/STLedgerEntry.h> #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> #include <boost/optional.hpp>
namespace ripple { namespace ripple {
@@ -154,11 +159,14 @@ public:
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Unfortunately necessary for DeferredCredits // Called to adjust returned balances
// This is required to support PaymentView
virtual virtual
STAmount STAmount
deprecatedBalance (AccountID const& account, balanceHook (AccountID const& account,
AccountID const& issuer, STAmount const& amount) const AccountID const& issuer,
STAmount const& amount) const
{ {
return amount; return amount;
} }
@@ -288,15 +296,254 @@ public:
bool bool
openLedger() const = 0; openLedger() const = 0;
// Unfortunately necessary for DeferredCredits //--------------------------------------------------------------------------
// Called when a credit is made to an account
// This is required to support PaymentView
virtual virtual
void void
deprecatedCreditHint (AccountID const& from, creditHook (AccountID const& from,
AccountID const& to, STAmount const& amount) 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 } // ripple
#endif #endif

View File

@@ -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

View File

@@ -142,6 +142,22 @@ STAmount DeferredCredits::adjustedBalance (AccountID const& main,
return result; 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 () void DeferredCredits::clear ()
{ {
map_.clear (); map_.clear ();

View File

@@ -18,7 +18,7 @@
//============================================================================== //==============================================================================
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/ledger/ViewAPI.h> #include <ripple/ledger/View.h>
#include <ripple/basics/Log.h> #include <ripple/basics/Log.h>
#include <ripple/basics/StringUtilities.h> #include <ripple/basics/StringUtilities.h>
#include <ripple/protocol/Quality.h> #include <ripple/protocol/Quality.h>
@@ -146,16 +146,14 @@ accountHolds (BasicView const& view,
{ {
amount.clear (IssueRef (currency, issuer)); amount.clear (IssueRef (currency, issuer));
} }
else if (account > issuer)
{
// Put balance in account terms.
amount = sle->getFieldAmount (sfBalance);
amount.negate();
amount.setIssuer (issuer);
}
else else
{ {
amount = sle->getFieldAmount (sfBalance); amount = sle->getFieldAmount (sfBalance);
if (account > issuer)
{
// Put balance in account terms.
amount.negate();
}
amount.setIssuer (issuer); amount.setIssuer (issuer);
} }
WriteLog (lsTRACE, View) << "accountHolds:" << WriteLog (lsTRACE, View) << "accountHolds:" <<
@@ -163,7 +161,8 @@ accountHolds (BasicView const& view,
" amount=" << amount.getFullText (); " amount=" << amount.getFullText ();
} }
return view.deprecatedBalance(account, issuer, amount); return view.balanceHook(
account, issuer, amount);
} }
STAmount STAmount
@@ -773,8 +772,8 @@ trustCreate (View& view,
// Issuer should be noAccount() // Issuer should be noAccount()
STAmount const& saLimit, // --> limit for account being set. STAmount const& saLimit, // --> limit for account being set.
// Issuer should be the account being set. // Issuer should be the account being set.
const std::uint32_t uQualityIn, std::uint32_t uQualityIn,
const std::uint32_t uQualityOut) std::uint32_t uQualityOut)
{ {
WriteLog (lsTRACE, View) WriteLog (lsTRACE, View)
<< "trustCreate: " << to_string (uSrcAccountID) << ", " << "trustCreate: " << to_string (uSrcAccountID) << ", "
@@ -868,7 +867,8 @@ trustCreate (View& view,
// ONLY: Create ripple balance. // ONLY: Create ripple balance.
sleRippleState->setFieldAmount (sfBalance, bSetHigh ? -saBalance : saBalance); sleRippleState->setFieldAmount (sfBalance, bSetHigh ? -saBalance : saBalance);
view.deprecatedCreditHint (uSrcAccountID, uDstAccountID, saBalance); view.creditHook (uSrcAccountID,
uDstAccountID, saBalance);
} }
return terResult; return terResult;
@@ -1003,11 +1003,14 @@ rippleCredit (View& view,
noRipple, noRipple,
false, false,
saBalance, saBalance,
saReceiverLimit); saReceiverLimit,
0,
0);
} }
else else
{ {
view.deprecatedCreditHint(uSenderID, uReceiverID, saAmount); view.creditHook (uSenderID,
uReceiverID, saAmount);
STAmount saBalance = sleRippleState->getFieldAmount (sfBalance); STAmount saBalance = sleRippleState->getFieldAmount (sfBalance);
@@ -1133,6 +1136,7 @@ rippleSend (View& view,
if (uSenderID == issuer || uReceiverID == issuer || issuer == noAccount()) if (uSenderID == issuer || uReceiverID == issuer || issuer == noAccount())
{ {
// VFALCO Why do we need this bCheckIssuer?
// Direct send: redeeming IOUs and/or sending own IOUs. // Direct send: redeeming IOUs and/or sending own IOUs.
terResult = rippleCredit (view, uSenderID, uReceiverID, saAmount, false); terResult = rippleCredit (view, uSenderID, uReceiverID, saAmount, false);
saActual = saAmount; saActual = saAmount;
@@ -1156,10 +1160,10 @@ rippleSend (View& view,
" fee=" << saTransitFee.getFullText () << " fee=" << saTransitFee.getFullText () <<
" cost=" << saActual.getFullText (); " cost=" << saActual.getFullText ();
terResult = rippleCredit (view, issuer, uReceiverID, saAmount); terResult = rippleCredit (view, issuer, uReceiverID, saAmount, true);
if (tesSUCCESS == terResult) if (tesSUCCESS == terResult)
terResult = rippleCredit (view, uSenderID, issuer, saActual); terResult = rippleCredit (view, uSenderID, issuer, saActual, true);
} }
return terResult; return terResult;
@@ -1189,7 +1193,8 @@ accountSend (View& view,
return rippleSend (view, uSenderID, uReceiverID, saAmount, saActual); 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. /* 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 * 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; bool noRipple = (receiverAccount->getFlags() & lsfDefaultRipple) == 0;
return trustCreate (view, bSenderHigh, issue.account, account, index, 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); STAmount final_balance = state->getFieldAmount (sfBalance);
@@ -1377,7 +1382,8 @@ issueIOU (View& view,
if (bSenderHigh) if (bSenderHigh)
final_balance.negate (); 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 // 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 // are going to delete the line to reflect the correct balance at the time
@@ -1443,7 +1449,8 @@ redeemIOU (View& view,
if (bSenderHigh) if (bSenderHigh)
final_balance.negate (); 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 // 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 // are going to delete the line to reflect the correct balance at the time

View File

@@ -20,7 +20,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/rpc/impl/Tuning.h> #include <ripple/rpc/impl/Tuning.h>
#include <ripple/app/paths/RippleState.h> #include <ripple/app/paths/RippleState.h>

View File

@@ -19,7 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/rpc/impl/Tuning.h> #include <ripple/rpc/impl/Tuning.h>

View File

@@ -20,7 +20,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/app/main/Application.h> #include <ripple/app/main/Application.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/rpc/impl/AccountFromString.h> #include <ripple/rpc/impl/AccountFromString.h>
#include <ripple/rpc/impl/LookupLedger.h> #include <ripple/rpc/impl/LookupLedger.h>
#include <ripple/app/paths/RippleState.h> #include <ripple/app/paths/RippleState.h>

View File

@@ -22,7 +22,6 @@
#include <ripple/rpc/impl/Tuning.h> #include <ripple/rpc/impl/Tuning.h>
#include <ripple/app/ledger/LedgerFees.h> #include <ripple/app/ledger/LedgerFees.h>
#include <ripple/ledger/CachedView.h> #include <ripple/ledger/CachedView.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/app/paths/RippleState.h> #include <ripple/app/paths/RippleState.h>
#include <ripple/protocol/TxFlags.h> #include <ripple/protocol/TxFlags.h>

View File

@@ -23,6 +23,7 @@
#include <ripple/app/paths/AccountCurrencies.h> #include <ripple/app/paths/AccountCurrencies.h>
#include <ripple/app/paths/FindPaths.h> #include <ripple/app/paths/FindPaths.h>
#include <ripple/app/paths/RippleCalc.h> #include <ripple/app/paths/RippleCalc.h>
#include <ripple/app/paths/impl/PaymentView.h>
#include <ripple/core/LoadFeeTrack.h> #include <ripple/core/LoadFeeTrack.h>
#include <ripple/protocol/STParsedJSON.h> #include <ripple/protocol/STParsedJSON.h>
#include <ripple/protocol/types.h> #include <ripple/protocol/types.h>
@@ -281,10 +282,11 @@ ripplePathFind (RippleLineCache::pointer const& cache,
STAmount saMaxAmount({ uSrcCurrencyID, issuer }, 1); STAmount saMaxAmount({ uSrcCurrencyID, issuer }, 1);
saMaxAmount.negate(); saMaxAmount.negate();
MetaView sandbox(lpLedger, tapNONE); boost::optional<PaymentView> sandbox;
sandbox.emplace(lpLedger, tapNONE);
auto rc = path::RippleCalc::rippleCalculate( auto rc = path::RippleCalc::rippleCalculate(
sandbox, *sandbox,
saMaxAmount, // --> Amount to send is unlimited saMaxAmount, // --> Amount to send is unlimited
// to get an estimate. // to get an estimate.
saDstAmount, // --> Amount to deliver. saDstAmount, // --> Amount to deliver.
@@ -306,9 +308,9 @@ ripplePathFind (RippleLineCache::pointer const& cache,
<< "Trying with an extra path element"; << "Trying with an extra path element";
spsComputed.push_back(fullLiquidityPath); spsComputed.push_back(fullLiquidityPath);
reconstruct(sandbox, lpLedger, tapNONE); sandbox.emplace(lpLedger, tapNONE);
rc = path::RippleCalc::rippleCalculate( rc = path::RippleCalc::rippleCalculate(
sandbox, *sandbox,
saMaxAmount, // --> Amount to send is unlimited saMaxAmount, // --> Amount to send is unlimited
// to get an estimate. // to get an estimate.
saDstAmount, // --> Amount to deliver. saDstAmount, // --> Amount to deliver.

View File

@@ -18,7 +18,6 @@
//============================================================================== //==============================================================================
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/ledger/ViewAPI.h>
#include <ripple/test/jtx/owners.h> #include <ripple/test/jtx/owners.h>
namespace ripple { namespace ripple {

View File

@@ -24,16 +24,13 @@
#include <ripple/app/paths/Credit.cpp> #include <ripple/app/paths/Credit.cpp>
#include <ripple/app/paths/FindPaths.cpp> #include <ripple/app/paths/FindPaths.cpp>
#include <ripple/app/paths/Pathfinder.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/Node.cpp>
#include <ripple/app/paths/PathRequest.cpp> #include <ripple/app/paths/PathRequest.cpp>
#include <ripple/app/paths/PathRequests.cpp> #include <ripple/app/paths/PathRequests.cpp>
#include <ripple/app/paths/PathState.cpp> #include <ripple/app/paths/PathState.cpp>
#include <ripple/app/paths/RippleCalc.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/AdvanceNode.cpp>
#include <ripple/app/paths/cursor/DeliverNodeForward.cpp> #include <ripple/app/paths/cursor/DeliverNodeForward.cpp>
#include <ripple/app/paths/cursor/DeliverNodeReverse.cpp> #include <ripple/app/paths/cursor/DeliverNodeReverse.cpp>
@@ -44,7 +41,5 @@
#include <ripple/app/paths/cursor/ReverseLiquidity.cpp> #include <ripple/app/paths/cursor/ReverseLiquidity.cpp>
#include <ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp> #include <ripple/app/paths/cursor/ReverseLiquidityForAccount.cpp>
#include <ripple/app/paths/cursor/RippleLiquidity.cpp> #include <ripple/app/paths/cursor/RippleLiquidity.cpp>
#include <ripple/app/paths/RippleLineCache.cpp>
#ifdef _MSC_VER #include <ripple/app/paths/impl/PaymentView.cpp>
#pragma warning (pop)
#endif

View File

@@ -19,29 +19,28 @@
#include <BeastConfig.h> #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/InboundTransactions.cpp>
#include <ripple/app/tx/impl/LocalTxs.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/TransactionMaster.cpp>
#include <ripple/app/tx/impl/Transaction.cpp> #include <ripple/app/tx/impl/Transaction.cpp>
#include <ripple/app/tx/impl/TransactionEngine.cpp> #include <ripple/app/tx/impl/TransactionEngine.cpp>
#include <ripple/app/tx/impl/TransactionMeta.cpp> #include <ripple/app/tx/impl/TransactionMeta.cpp>
#include <ripple/app/tx/impl/TransactionAcquire.cpp> #include <ripple/app/tx/impl/TransactionAcquire.cpp>
#include <ripple/app/tx/impl/Transactor.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/common_transactor.cpp>
#include <ripple/app/tx/tests/MultiSign.test.cpp> #include <ripple/app/tx/tests/MultiSign.test.cpp>

View File

@@ -19,6 +19,6 @@
#include <BeastConfig.h> #include <BeastConfig.h>
#include <ripple/ledger/impl/DeferredCredits.cpp>
#include <ripple/ledger/impl/CachedView.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>