mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-02 00:45:58 +00:00
Pathfinding cleanup:
* Remove unused code * Do not use `pointer` and `ref` type aliases * Misc. cleanups
This commit is contained in:
committed by
Vinnie Falco
parent
9cb02028ed
commit
d736232142
@@ -1436,12 +1436,6 @@
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\cursor\RippleLiquidity.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\FindPaths.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\Node.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='debug|x64'">True</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='release|x64'">True</ExcludedFromBuild>
|
||||
|
||||
@@ -2028,12 +2028,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\cursor\RippleLiquidity.h">
|
||||
<Filter>ripple\app\paths\cursor</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\FindPaths.cpp">
|
||||
<Filter>ripple\app\paths</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\app\paths\FindPaths.h">
|
||||
<Filter>ripple\app\paths</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\app\paths\Node.cpp">
|
||||
<Filter>ripple\app\paths</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace ripple {
|
||||
|
||||
hash_set<Currency> accountSourceCurrencies (
|
||||
AccountID const& account,
|
||||
RippleLineCache::ref lrCache,
|
||||
std::shared_ptr<RippleLineCache> const& lrCache,
|
||||
bool includeXRP)
|
||||
{
|
||||
hash_set<Currency> currencies;
|
||||
@@ -62,7 +62,7 @@ hash_set<Currency> accountSourceCurrencies (
|
||||
|
||||
hash_set<Currency> accountDestCurrencies (
|
||||
AccountID const& account,
|
||||
RippleLineCache::ref lrCache,
|
||||
std::shared_ptr<RippleLineCache> const& lrCache,
|
||||
bool includeXRP)
|
||||
{
|
||||
hash_set<Currency> currencies;
|
||||
|
||||
@@ -28,13 +28,13 @@ namespace ripple {
|
||||
hash_set<Currency>
|
||||
accountDestCurrencies(
|
||||
AccountID const& account,
|
||||
RippleLineCache::ref cache,
|
||||
std::shared_ptr<RippleLineCache> const& cache,
|
||||
bool includeXRP);
|
||||
|
||||
hash_set<Currency>
|
||||
accountSourceCurrencies(
|
||||
AccountID const& account,
|
||||
RippleLineCache::ref lrLedger,
|
||||
std::shared_ptr<RippleLineCache> const& lrLedger,
|
||||
bool includeXRP);
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/app/paths/FindPaths.h>
|
||||
#include <ripple/app/paths/Pathfinder.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class FindPaths::Impl {
|
||||
public:
|
||||
Impl (
|
||||
RippleLineCache::ref cache,
|
||||
AccountID const& srcAccount,
|
||||
AccountID const& dstAccount,
|
||||
STAmount const& dstAmount,
|
||||
boost::optional<STAmount> const& srcAmount,
|
||||
int searchLevel,
|
||||
unsigned int maxPaths)
|
||||
: cache_ (cache),
|
||||
srcAccount_ (srcAccount),
|
||||
dstAccount_ (dstAccount),
|
||||
dstAmount_ (dstAmount),
|
||||
srcAmount_ (srcAmount),
|
||||
searchLevel_ (searchLevel),
|
||||
maxPaths_ (maxPaths)
|
||||
{
|
||||
}
|
||||
|
||||
boost::optional<STPathSet>
|
||||
findPathsForIssue (
|
||||
Issue const& issue,
|
||||
STPathSet const& paths,
|
||||
STPath& fullLiquidityPath,
|
||||
Application& app)
|
||||
{
|
||||
if (auto& pathfinder = getPathFinder (issue.currency, app))
|
||||
{
|
||||
return pathfinder->getBestPaths (maxPaths_,
|
||||
fullLiquidityPath, paths, issue.account);
|
||||
}
|
||||
assert (false);
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
private:
|
||||
hash_map<Currency, std::unique_ptr<Pathfinder>> currencyMap_;
|
||||
|
||||
RippleLineCache::ref cache_;
|
||||
AccountID const srcAccount_;
|
||||
AccountID const dstAccount_;
|
||||
STAmount const dstAmount_;
|
||||
boost::optional<STAmount> const srcAmount_;
|
||||
int const searchLevel_;
|
||||
unsigned int const maxPaths_;
|
||||
|
||||
std::unique_ptr<Pathfinder> const&
|
||||
getPathFinder (Currency const& currency, Application& app)
|
||||
{
|
||||
auto i = currencyMap_.find (currency);
|
||||
if (i != currencyMap_.end ())
|
||||
return i->second;
|
||||
auto pathfinder = std::make_unique<Pathfinder> (
|
||||
cache_, srcAccount_, dstAccount_, currency,
|
||||
boost::none, dstAmount_, srcAmount_, app);
|
||||
if (pathfinder->findPaths (searchLevel_))
|
||||
pathfinder->computePathRanks (maxPaths_);
|
||||
else
|
||||
pathfinder.reset (); // It's a bad request - clear it.
|
||||
return currencyMap_[currency] = std::move (pathfinder);
|
||||
|
||||
// TODO(tom): why doesn't this faster way compile?
|
||||
// return currencyMap_.insert (i, std::move (pathfinder)).second;
|
||||
}
|
||||
};
|
||||
|
||||
FindPaths::FindPaths (
|
||||
RippleLineCache::ref cache,
|
||||
AccountID const& srcAccount,
|
||||
AccountID const& dstAccount,
|
||||
STAmount const& dstAmount,
|
||||
boost::optional<STAmount> const& srcAmount,
|
||||
int level,
|
||||
unsigned int maxPaths)
|
||||
: impl_ (std::make_unique<Impl> (
|
||||
cache, srcAccount, dstAccount,
|
||||
dstAmount, srcAmount, level, maxPaths))
|
||||
{
|
||||
}
|
||||
|
||||
FindPaths::~FindPaths() = default;
|
||||
|
||||
boost::optional<STPathSet>
|
||||
FindPaths::findPathsForIssue (
|
||||
Issue const& issue,
|
||||
STPathSet const& paths,
|
||||
STPath& fullLiquidityPath,
|
||||
Application& app)
|
||||
{
|
||||
return impl_->findPathsForIssue (issue, paths, fullLiquidityPath, app);
|
||||
}
|
||||
|
||||
boost::optional<STPathSet>
|
||||
findPathsForOneIssuer (
|
||||
RippleLineCache::ref cache,
|
||||
AccountID const& srcAccount,
|
||||
AccountID const& dstAccount,
|
||||
Issue const& srcIssue,
|
||||
STAmount const& dstAmount,
|
||||
int searchLevel,
|
||||
unsigned int const maxPaths,
|
||||
STPathSet const& paths,
|
||||
STPath& fullLiquidityPath,
|
||||
Application& app)
|
||||
{
|
||||
Pathfinder pf (
|
||||
cache,
|
||||
srcAccount,
|
||||
dstAccount,
|
||||
srcIssue.currency,
|
||||
srcIssue.account,
|
||||
dstAmount,
|
||||
boost::none,
|
||||
app);
|
||||
|
||||
if (! pf.findPaths(searchLevel))
|
||||
return boost::none;
|
||||
|
||||
pf.computePathRanks (maxPaths);
|
||||
return pf.getBestPaths(maxPaths, fullLiquidityPath,
|
||||
paths, srcIssue.account);
|
||||
}
|
||||
|
||||
void initializePathfinding ()
|
||||
{
|
||||
Pathfinder::initPathTable ();
|
||||
}
|
||||
|
||||
} // ripple
|
||||
@@ -1,101 +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_APP_PATHS_FINDPATHS_H_INCLUDED
|
||||
#define RIPPLE_APP_PATHS_FINDPATHS_H_INCLUDED
|
||||
|
||||
#include <ripple/app/paths/RippleLineCache.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class FindPaths
|
||||
{
|
||||
public:
|
||||
FindPaths (
|
||||
RippleLineCache::ref cache,
|
||||
AccountID const& srcAccount,
|
||||
AccountID const& dstAccount,
|
||||
STAmount const& dstAmount,
|
||||
boost::optional<STAmount> const& srcAmount,
|
||||
/** searchLevel is the maximum search level allowed in an output path.
|
||||
*/
|
||||
int searchLevel,
|
||||
/** maxPaths is the maximum number of paths that can be returned in
|
||||
pathsOut. */
|
||||
unsigned int const maxPaths);
|
||||
~FindPaths();
|
||||
|
||||
/** The return value will have any additional paths found. Only
|
||||
non-default paths without source or destination will be added. */
|
||||
boost::optional<STPathSet>
|
||||
findPathsForIssue (
|
||||
Issue const& issue,
|
||||
|
||||
/** Contains any paths you want to ensure are
|
||||
included if still good. */
|
||||
STPathSet const& paths,
|
||||
|
||||
/** On input, fullLiquidityPath must be an empty STPath.
|
||||
|
||||
On output, if fullLiquidityPath is non-empty, it contains one extra
|
||||
path that can move the entire liquidity requested. */
|
||||
STPath& fullLiquidityPath,
|
||||
|
||||
Application& app);
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
|
||||
/** The return value will have any additional paths found. Only
|
||||
non-default paths without source or destination will be added. */
|
||||
boost::optional<STPathSet>
|
||||
findPathsForOneIssuer (
|
||||
RippleLineCache::ref cache,
|
||||
AccountID const& srcAccount,
|
||||
AccountID const& dstAccount,
|
||||
Issue const& srcIssue,
|
||||
STAmount const& dstAmount,
|
||||
|
||||
/** searchLevel is the maximum search level allowed in an output path. */
|
||||
int searchLevel,
|
||||
|
||||
/** maxPaths is the maximum number of paths that can be returned in
|
||||
pathsOut. */
|
||||
unsigned int const maxPaths,
|
||||
|
||||
/** Contains any paths you want to ensure are included if
|
||||
still good.
|
||||
*/
|
||||
STPathSet const& paths,
|
||||
|
||||
/** On input, fullLiquidityPath must be an empty STPath.
|
||||
|
||||
On output, if fullLiquidityPath is non-empty, it contains one extra path
|
||||
that can move the entire liquidity requested. */
|
||||
STPath& fullLiquidityPath,
|
||||
|
||||
Application& app);
|
||||
|
||||
void initializePathfinding ();
|
||||
|
||||
} // ripple
|
||||
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ void PathRequest::updateComplete ()
|
||||
}
|
||||
}
|
||||
|
||||
bool PathRequest::isValid (RippleLineCache::ref crCache)
|
||||
bool PathRequest::isValid (std::shared_ptr<RippleLineCache> const& crCache)
|
||||
{
|
||||
if (! raSrcAccount || ! raDstAccount)
|
||||
return false;
|
||||
@@ -171,16 +171,16 @@ bool PathRequest::isValid (RippleLineCache::ref crCache)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! crCache->getLedger()->exists(
|
||||
keylet::account(*raSrcAccount)))
|
||||
auto const& lrLedger = crCache->getLedger();
|
||||
|
||||
if (! lrLedger->exists(keylet::account(*raSrcAccount)))
|
||||
{
|
||||
// Source account does not exist.
|
||||
jvStatus = rpcError (rpcSRC_ACT_NOT_FOUND);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto const& lrLedger = crCache->getLedger();
|
||||
auto const sleDest = crCache->getLedger()->read(
|
||||
auto const sleDest = lrLedger->read(
|
||||
keylet::account(*raDstAccount));
|
||||
|
||||
Json::Value& jvDestCur =
|
||||
@@ -234,7 +234,7 @@ bool PathRequest::isValid (RippleLineCache::ref crCache)
|
||||
*/
|
||||
std::pair<bool, Json::Value>
|
||||
PathRequest::doCreate (
|
||||
RippleLineCache::ref& cache,
|
||||
std::shared_ptr<RippleLineCache> const& cache,
|
||||
Json::Value const& value)
|
||||
{
|
||||
bool valid = false;
|
||||
@@ -435,7 +435,7 @@ Json::Value PathRequest::doStatus (Json::Value const&)
|
||||
}
|
||||
|
||||
std::unique_ptr<Pathfinder> const&
|
||||
PathRequest::getPathFinder(RippleLineCache::ref cache,
|
||||
PathRequest::getPathFinder(std::shared_ptr<RippleLineCache> const& cache,
|
||||
hash_map<Currency, std::unique_ptr<Pathfinder>>& currency_map,
|
||||
Currency const& currency, STAmount const& dst_amount,
|
||||
int const level)
|
||||
@@ -454,7 +454,7 @@ PathRequest::getPathFinder(RippleLineCache::ref cache,
|
||||
}
|
||||
|
||||
bool
|
||||
PathRequest::findPaths (RippleLineCache::ref cache, int const level,
|
||||
PathRequest::findPaths (std::shared_ptr<RippleLineCache> const& cache, int const level,
|
||||
Json::Value& jvArray)
|
||||
{
|
||||
auto sourceCurrencies = sciSourceCurrencies;
|
||||
@@ -588,7 +588,7 @@ PathRequest::findPaths (RippleLineCache::ref cache, int const level,
|
||||
return true;
|
||||
}
|
||||
|
||||
Json::Value PathRequest::doUpdate (RippleLineCache::ref cache, bool fast)
|
||||
Json::Value PathRequest::doUpdate (std::shared_ptr<RippleLineCache> const& cache, bool fast)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
m_journal.debug << iIdentifier << " update " << (fast ? "fast" : "normal");
|
||||
|
||||
@@ -81,25 +81,26 @@ public:
|
||||
Json::Value getStatus ();
|
||||
|
||||
std::pair<bool, Json::Value> doCreate (
|
||||
const RippleLineCache::pointer&,
|
||||
std::shared_ptr<RippleLineCache> const&,
|
||||
Json::Value const&);
|
||||
|
||||
Json::Value doClose (Json::Value const&);
|
||||
Json::Value doStatus (Json::Value const&);
|
||||
|
||||
// update jvStatus
|
||||
Json::Value doUpdate (const std::shared_ptr<RippleLineCache>&, bool fast);
|
||||
Json::Value doUpdate (
|
||||
std::shared_ptr<RippleLineCache> const&, bool fast);
|
||||
InfoSub::pointer getSubscriber ();
|
||||
bool hasCompletion ();
|
||||
|
||||
private:
|
||||
using ScopedLockType = std::lock_guard <std::recursive_mutex>;
|
||||
|
||||
bool isValid (RippleLineCache::ref crCache);
|
||||
bool isValid (std::shared_ptr<RippleLineCache> const& crCache);
|
||||
void setValid ();
|
||||
|
||||
std::unique_ptr<Pathfinder> const&
|
||||
getPathFinder(RippleLineCache::ref,
|
||||
getPathFinder(std::shared_ptr<RippleLineCache> const&,
|
||||
hash_map<Currency, std::unique_ptr<Pathfinder>>&, Currency const&,
|
||||
STAmount const&, int const);
|
||||
|
||||
@@ -107,7 +108,7 @@ private:
|
||||
Returns false if the source currencies are inavlid.
|
||||
*/
|
||||
bool
|
||||
findPaths (RippleLineCache::ref, int const, Json::Value&);
|
||||
findPaths (std::shared_ptr<RippleLineCache> const&, int const, Json::Value&);
|
||||
|
||||
int parseJson (Json::Value const&);
|
||||
|
||||
|
||||
@@ -32,10 +32,11 @@ namespace ripple {
|
||||
/** Get the current RippleLineCache, updating it if necessary.
|
||||
Get the correct ledger to use.
|
||||
*/
|
||||
RippleLineCache::pointer PathRequests::getLineCache (
|
||||
std::shared_ptr <ReadView const> const& ledger, bool authoritative)
|
||||
std::shared_ptr<RippleLineCache>
|
||||
PathRequests::getLineCache (
|
||||
std::shared_ptr <ReadView const> const& ledger,
|
||||
bool authoritative)
|
||||
{
|
||||
|
||||
ScopedLockType sl (mLock);
|
||||
|
||||
std::uint32_t lineSeq = mLineCache ? mLineCache->getLedger()->seq() : 0;
|
||||
@@ -59,7 +60,7 @@ void PathRequests::updateAll (std::shared_ptr <ReadView const> const& inLedger,
|
||||
jtPATH_FIND, "PathRequest::updateAll");
|
||||
|
||||
std::vector<PathRequest::wptr> requests;
|
||||
RippleLineCache::pointer cache;
|
||||
std::shared_ptr<RippleLineCache> cache;
|
||||
|
||||
// Get the ledger and cache we should be using
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void updateAll (std::shared_ptr<ReadView const> const& ledger,
|
||||
Job::CancelCallback shouldCancel);
|
||||
|
||||
RippleLineCache::pointer getLineCache (
|
||||
std::shared_ptr<RippleLineCache> getLineCache (
|
||||
std::shared_ptr <ReadView const> const& ledger, bool authoritative);
|
||||
|
||||
Json::Value makePathRequest (
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
std::vector<PathRequest::wptr> requests_;
|
||||
|
||||
// Use a RippleLineCache
|
||||
RippleLineCache::pointer mLineCache;
|
||||
std::shared_ptr<RippleLineCache> mLineCache;
|
||||
|
||||
std::atomic<int> mLastIdentifier;
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ std::string pathTypeToString (Pathfinder::PathType const& type)
|
||||
} // namespace
|
||||
|
||||
Pathfinder::Pathfinder (
|
||||
RippleLineCache::ref cache,
|
||||
std::shared_ptr<RippleLineCache> const& cache,
|
||||
AccountID const& uSrcAccount,
|
||||
AccountID const& uDstAccount,
|
||||
Currency const& uSrcCurrency,
|
||||
|
||||
@@ -39,7 +39,7 @@ class Pathfinder
|
||||
public:
|
||||
/** Construct a pathfinder without an issuer.*/
|
||||
Pathfinder (
|
||||
RippleLineCache::ref cache,
|
||||
std::shared_ptr<RippleLineCache> const& cache,
|
||||
AccountID const& srcAccount,
|
||||
AccountID const& dstAccount,
|
||||
Currency const& uSrcCurrency,
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
|
||||
std::shared_ptr <ReadView const> mLedger;
|
||||
LoadEvent::pointer m_loadEvent;
|
||||
RippleLineCache::pointer mRLCache;
|
||||
std::shared_ptr<RippleLineCache> mRLCache;
|
||||
|
||||
STPathElement mSource;
|
||||
STPathSet mCompletePaths;
|
||||
|
||||
@@ -32,17 +32,19 @@ RippleLineCache::RippleLineCache(
|
||||
mLedger = std::make_shared<OpenView>(&*ledger, ledger);
|
||||
}
|
||||
|
||||
RippleLineCache::RippleStateVector const&
|
||||
std::vector<RippleState::pointer> const&
|
||||
RippleLineCache::getRippleLines (AccountID const& accountID)
|
||||
{
|
||||
AccountKey key (accountID, hasher_ (accountID));
|
||||
|
||||
std::lock_guard <std::mutex> sl (mLock);
|
||||
|
||||
auto it = mRLMap.emplace (key, RippleStateVector ());
|
||||
auto it = lines_.emplace (key,
|
||||
std::vector<RippleState::pointer>());
|
||||
|
||||
if (it.second)
|
||||
it.first->second = ripple::getRippleStateItems (accountID, *mLedger);
|
||||
it.first->second = getRippleStateItems (
|
||||
accountID, *mLedger);
|
||||
|
||||
return it.first->second;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,12 @@ namespace ripple {
|
||||
class RippleLineCache
|
||||
{
|
||||
public:
|
||||
using RippleStateVector = std::vector <RippleState::pointer>;
|
||||
using pointer = std::shared_ptr <RippleLineCache>;
|
||||
using ref = pointer const&;
|
||||
|
||||
explicit RippleLineCache (std::shared_ptr <ReadView const> const& l);
|
||||
explicit
|
||||
RippleLineCache (
|
||||
std::shared_ptr <ReadView const> const& l);
|
||||
|
||||
std::shared_ptr <ReadView const> const&
|
||||
getLedger () // VFALCO TODO const?
|
||||
getLedger () const
|
||||
{
|
||||
return mLedger;
|
||||
}
|
||||
@@ -91,7 +89,10 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
hash_map <AccountKey, RippleStateVector, AccountKey::Hash> mRLMap;
|
||||
hash_map <
|
||||
AccountKey,
|
||||
std::vector <RippleState::pointer>,
|
||||
AccountKey::Hash> lines_;
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ripple {
|
||||
|
||||
@note Presented as ApplyView to clients.
|
||||
*/
|
||||
class ApplyViewImpl
|
||||
class ApplyViewImpl final
|
||||
: public detail::ApplyViewBase
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -45,7 +45,7 @@ extern open_ledger_t const open_ledger;
|
||||
|
||||
@note Presented as ReadView to clients.
|
||||
*/
|
||||
class OpenView
|
||||
class OpenView final
|
||||
: public ReadView
|
||||
, public TxsRawView
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
|
||||
@note Presented as ApplyView to clients
|
||||
*/
|
||||
class PaymentSandbox
|
||||
class PaymentSandbox final
|
||||
: public detail::ApplyViewBase
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
namespace ripple {
|
||||
|
||||
std::pair<bool, Json::Value>
|
||||
ripplePathFind (RippleLineCache::pointer const& cache,
|
||||
ripplePathFind (std::shared_ptr<RippleLineCache> const& cache,
|
||||
AccountID const& raSrc, AccountID const& raDst,
|
||||
STAmount const& saDstAmount,
|
||||
Json::Value const& jvSrcCurrencies,
|
||||
|
||||
@@ -52,7 +52,7 @@ static unsigned int const max_paths = 4;
|
||||
static
|
||||
Json::Value
|
||||
buildSrcCurrencies(AccountID const& account,
|
||||
RippleLineCache::pointer const& cache)
|
||||
std::shared_ptr<RippleLineCache> const& cache)
|
||||
{
|
||||
auto currencies = accountSourceCurrencies(account, cache, true);
|
||||
auto jvSrcCurrencies = Json::Value(Json::arrayValue);
|
||||
@@ -163,7 +163,7 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
}
|
||||
else
|
||||
{
|
||||
RippleLineCache::pointer cache;
|
||||
std::shared_ptr<RippleLineCache> cache;
|
||||
|
||||
if (lpLedger)
|
||||
{
|
||||
@@ -265,7 +265,7 @@ Json::Value doRipplePathFind (RPC::Context& context)
|
||||
}
|
||||
|
||||
std::unique_ptr<Pathfinder> const&
|
||||
getPathFinder(RippleLineCache::ref cache, AccountID const& raSrc,
|
||||
getPathFinder(std::shared_ptr<RippleLineCache> const& cache, AccountID const& raSrc,
|
||||
AccountID const& raDst, boost::optional<STAmount> saSendMax,
|
||||
hash_map<Currency, std::unique_ptr<Pathfinder>>& currency_map,
|
||||
Currency const& currency, STAmount const& dst_amount,
|
||||
@@ -284,7 +284,7 @@ getPathFinder(RippleLineCache::ref cache, AccountID const& raSrc,
|
||||
}
|
||||
|
||||
std::pair<bool, Json::Value>
|
||||
ripplePathFind (RippleLineCache::pointer const& cache,
|
||||
ripplePathFind (std::shared_ptr<RippleLineCache> const& cache,
|
||||
AccountID const& raSrc, AccountID const& raDst,
|
||||
STAmount const& saDstAmount, Json::Value const& jvSrcCurrencies,
|
||||
boost::optional<Json::Value> const& contextPaths,
|
||||
|
||||
Reference in New Issue
Block a user