mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
Cleanups and performance optimizations (RIPD-450):
* Remove AccountItems and AccountItem * Restructure RippleLineCache to not require shared_ptr * Avoid expensive copies of base_uint<160> in RippleState
This commit is contained in:
@@ -126,8 +126,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\build\proto\ripple.pb.h">
|
<ClInclude Include="..\..\build\proto\ripple.pb.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\BeastConfig.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
|
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\asio\abstract_socket.cpp">
|
<ClCompile Include="..\..\src\beast\beast\asio\abstract_socket.cpp">
|
||||||
@@ -304,14 +302,14 @@
|
|||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
|
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -825,14 +823,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
|
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
|
<ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -845,6 +835,14 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
|
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
|
<ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -1187,6 +1185,8 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\Version.h">
|
<ClInclude Include="..\..\src\beast\beast\Version.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\BeastConfig.h">
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
|
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -2179,16 +2179,6 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\main\Tuning.h">
|
<ClInclude Include="..\..\src\ripple\module\app\main\Tuning.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountItem.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\AccountItem.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountItems.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\AccountItems.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountState.cpp">
|
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountState.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -2224,11 +2214,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\NicknameState.h">
|
<ClInclude Include="..\..\src\ripple\module\app\misc\NicknameState.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\Offer.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\Offer.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\OrderBook.h">
|
<ClInclude Include="..\..\src\ripple\module\app\misc\OrderBook.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\PowResult.h">
|
<ClInclude Include="..\..\src\ripple\module\app\misc\PowResult.h">
|
||||||
|
|||||||
@@ -624,9 +624,6 @@
|
|||||||
<ClInclude Include="..\..\build\proto\ripple.pb.h">
|
<ClInclude Include="..\..\build\proto\ripple.pb.h">
|
||||||
<Filter>build\proto</Filter>
|
<Filter>build\proto</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\BeastConfig.h">
|
|
||||||
<Filter>.</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
|
<ClInclude Include="..\..\src\beast\beast\Arithmetic.h">
|
||||||
<Filter>beast</Filter>
|
<Filter>beast</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -858,15 +855,15 @@
|
|||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\MurmurHash.cpp">
|
||||||
<Filter>beast\crypto\impl</Filter>
|
<Filter>beast\crypto\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
|
|
||||||
<Filter>beast\crypto\impl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.c">
|
||||||
<Filter>beast\crypto\impl\sha2</Filter>
|
<Filter>beast\crypto\impl\sha2</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
|
<ClInclude Include="..\..\src\beast\beast\crypto\impl\sha2\sha2.h">
|
||||||
<Filter>beast\crypto\impl\sha2</Filter>
|
<Filter>beast\crypto\impl\sha2</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\Sha256.cpp">
|
||||||
|
<Filter>beast\crypto\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
|
<ClCompile Include="..\..\src\beast\beast\crypto\impl\UnsignedInteger.cpp">
|
||||||
<Filter>beast\crypto\impl</Filter>
|
<Filter>beast\crypto\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -1509,18 +1506,6 @@
|
|||||||
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
|
<ClInclude Include="..\..\src\beast\beast\module\core\text\StringPairArray.h">
|
||||||
<Filter>beast\module\core\text</Filter>
|
<Filter>beast\module\core\text</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
|
|
||||||
<Filter>beast\module\core\threads</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
|
|
||||||
<Filter>beast\module\core\threads</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
|
|
||||||
<Filter>beast\module\core\threads</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
|
|
||||||
<Filter>beast\module\core\threads</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
|
<ClCompile Include="..\..\src\beast\beast\module\core\thread\DeadlineTimer.cpp">
|
||||||
<Filter>beast\module\core\thread</Filter>
|
<Filter>beast\module\core\thread</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -1536,6 +1521,18 @@
|
|||||||
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
|
<ClInclude Include="..\..\src\beast\beast\module\core\thread\Workers.h">
|
||||||
<Filter>beast\module\core\thread</Filter>
|
<Filter>beast\module\core\thread</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\CriticalSection.h">
|
||||||
|
<Filter>beast\module\core\threads</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\DynamicLibrary.h">
|
||||||
|
<Filter>beast\module\core\threads</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\Process.h">
|
||||||
|
<Filter>beast\module\core\threads</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\module\core\threads\ScopedLock.h">
|
||||||
|
<Filter>beast\module\core\threads</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
|
<ClCompile Include="..\..\src\beast\beast\module\core\time\AtExitHook.cpp">
|
||||||
<Filter>beast\module\core\time</Filter>
|
<Filter>beast\module\core\time</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -1974,6 +1971,9 @@
|
|||||||
<ClInclude Include="..\..\src\beast\beast\Version.h">
|
<ClInclude Include="..\..\src\beast\beast\Version.h">
|
||||||
<Filter>beast</Filter>
|
<Filter>beast</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\BeastConfig.h">
|
||||||
|
<Filter>.</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
|
<ClCompile Include="..\..\src\hyperleveldb\db\builder.cc">
|
||||||
<Filter>hyperleveldb\db</Filter>
|
<Filter>hyperleveldb\db</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3201,18 +3201,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\module\app\main\Tuning.h">
|
<ClInclude Include="..\..\src\ripple\module\app\main\Tuning.h">
|
||||||
<Filter>ripple\module\app\main</Filter>
|
<Filter>ripple\module\app\main</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountItem.cpp">
|
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\AccountItem.h">
|
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountItems.cpp">
|
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\AccountItems.h">
|
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountState.cpp">
|
<ClCompile Include="..\..\src\ripple\module\app\misc\AccountState.cpp">
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
<Filter>ripple\module\app\misc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3255,12 +3243,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\NicknameState.h">
|
<ClInclude Include="..\..\src\ripple\module\app\misc\NicknameState.h">
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
<Filter>ripple\module\app\misc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\module\app\misc\Offer.cpp">
|
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\Offer.h">
|
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\module\app\misc\OrderBook.h">
|
<ClInclude Include="..\..\src\ripple\module\app\misc\OrderBook.h">
|
||||||
<Filter>ripple\module\app\misc</Filter>
|
<Filter>ripple\module\app\misc</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -1,28 +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.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
AccountItem::AccountItem (SerializedLedgerEntry::ref ledger)
|
|
||||||
: mLedgerEntry (ledger)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
@@ -1,87 +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_ACCOUNTITEM_H
|
|
||||||
#define RIPPLE_ACCOUNTITEM_H
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fetch ledger entries from an account's owner dir.
|
|
||||||
//
|
|
||||||
/** Base class representing account items.
|
|
||||||
|
|
||||||
Account items include:
|
|
||||||
|
|
||||||
- Offers
|
|
||||||
- Trust Lines
|
|
||||||
|
|
||||||
NOTE these are deprecated and will go away, to be replaced with
|
|
||||||
simple visitor patterns.
|
|
||||||
*/
|
|
||||||
class AccountItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::shared_ptr <AccountItem> pointer;
|
|
||||||
typedef const pointer& ref;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Construct from a flat ledger entry.
|
|
||||||
*/
|
|
||||||
explicit AccountItem (SerializedLedgerEntry::ref ledger);
|
|
||||||
|
|
||||||
AccountItem () {}
|
|
||||||
virtual ~AccountItem () {}
|
|
||||||
|
|
||||||
virtual AccountItem::pointer makeItem (
|
|
||||||
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry) = 0;
|
|
||||||
|
|
||||||
// VFALCO TODO Make this const and change derived classes
|
|
||||||
virtual LedgerEntryType getType () = 0;
|
|
||||||
|
|
||||||
// VFALCO TODO Document the int parameter
|
|
||||||
virtual Json::Value getJson (int) = 0;
|
|
||||||
|
|
||||||
SerializedLedgerEntry::pointer getSLE ()
|
|
||||||
{
|
|
||||||
return mLedgerEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SerializedLedgerEntry& peekSLE () const
|
|
||||||
{
|
|
||||||
return *mLedgerEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
SerializedLedgerEntry& peekSLE ()
|
|
||||||
{
|
|
||||||
return *mLedgerEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
Blob getRaw () const;
|
|
||||||
|
|
||||||
// VFALCO TODO Make this private and use the existing accessors
|
|
||||||
//
|
|
||||||
protected:
|
|
||||||
// VFALCO TODO Research making the object pointed to const
|
|
||||||
SerializedLedgerEntry::pointer mLedgerEntry;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,85 +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.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
AccountItems::AccountItems (Account const& accountID,
|
|
||||||
Ledger::ref ledger,
|
|
||||||
AccountItem::pointer ofType)
|
|
||||||
{
|
|
||||||
mOfType = ofType;
|
|
||||||
|
|
||||||
fillItems (accountID, ledger);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AccountItems::fillItems (Account const& accountID, Ledger::ref ledger)
|
|
||||||
{
|
|
||||||
uint256 const rootIndex = Ledger::getOwnerDirIndex (accountID);
|
|
||||||
uint256 currentIndex = rootIndex;
|
|
||||||
|
|
||||||
// VFALCO TODO Rewrite all infinite loops to have clear terminating
|
|
||||||
// conditions defined in one location.
|
|
||||||
//
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
SLE::pointer ownerDir = ledger->getDirNode (currentIndex);
|
|
||||||
|
|
||||||
// VFALCO TODO Rewrite to not return from the middle of the function
|
|
||||||
if (!ownerDir)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (auto const& uNode: ownerDir->getFieldV256 (sfIndexes).peekValue ())
|
|
||||||
{
|
|
||||||
// VFALCO TODO rename getSLEi() to something legible.
|
|
||||||
SLE::pointer sleCur = ledger->getSLEi (uNode);
|
|
||||||
|
|
||||||
if (sleCur)
|
|
||||||
{
|
|
||||||
// The item in the directory is in ledger
|
|
||||||
auto item = mOfType->makeItem (accountID, sleCur);
|
|
||||||
|
|
||||||
// makeItem() returns nullptr if the item wasn't one this
|
|
||||||
// particular AccountItems was interested in - for example, if
|
|
||||||
// the owner is only interested in ripple lines and this is an
|
|
||||||
// offer.
|
|
||||||
if (item)
|
|
||||||
mItems.push_back (item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::uint64_t uNodeNext = ownerDir->getFieldU64 (sfIndexNext);
|
|
||||||
|
|
||||||
if (!uNodeNext)
|
|
||||||
return;
|
|
||||||
|
|
||||||
currentIndex = Ledger::getDirNodeIndex (rootIndex, uNodeNext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::Value AccountItems::getJson (int v)
|
|
||||||
{
|
|
||||||
Json::Value ret (Json::arrayValue);
|
|
||||||
|
|
||||||
for (auto ai: mItems)
|
|
||||||
ret.append (ai->getJson (v));
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
@@ -1,60 +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_ACCOUNTITEMS_H
|
|
||||||
#define RIPPLE_ACCOUNTITEMS_H
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
/** A set of AccountItem objects. */
|
|
||||||
class AccountItems : beast::LeakChecked <AccountItems>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::shared_ptr <AccountItems> pointer;
|
|
||||||
|
|
||||||
typedef std::vector <AccountItem::pointer> Container;
|
|
||||||
|
|
||||||
AccountItems (Account const& accountID,
|
|
||||||
Ledger::ref ledger,
|
|
||||||
AccountItem::pointer ofType);
|
|
||||||
|
|
||||||
// VFALCO TODO rename to getContainer and make this change in every interface
|
|
||||||
// that exposes the caller to the type of container.
|
|
||||||
//
|
|
||||||
Container& getItems ()
|
|
||||||
{
|
|
||||||
return mItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
// VFALCO TODO What is the int for?
|
|
||||||
Json::Value getJson (int);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void fillItems (Account const& accountID, Ledger::ref ledger);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// VFALCO TODO This looks like its used as an exemplar, rename appropriately
|
|
||||||
AccountItem::pointer mOfType;
|
|
||||||
|
|
||||||
Container mItems;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,49 +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.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
AccountItem::pointer Offer::makeItem (
|
|
||||||
Account const& , SerializedLedgerEntry::ref ledgerEntry)
|
|
||||||
{
|
|
||||||
if (!ledgerEntry || ledgerEntry->getType () != ltOFFER) return (AccountItem::pointer ());
|
|
||||||
|
|
||||||
Offer* offer = new Offer (ledgerEntry);
|
|
||||||
return (AccountItem::pointer (offer));
|
|
||||||
}
|
|
||||||
|
|
||||||
Offer::Offer (SerializedLedgerEntry::pointer ledgerEntry) : AccountItem (ledgerEntry),
|
|
||||||
mAccount (mLedgerEntry->getFieldAccount (sfAccount)),
|
|
||||||
mTakerGets (mLedgerEntry->getFieldAmount (sfTakerGets)),
|
|
||||||
mTakerPays (mLedgerEntry->getFieldAmount (sfTakerPays)),
|
|
||||||
mSeq (mLedgerEntry->getFieldU32 (sfSequence))
|
|
||||||
{
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::Value Offer::getJson (int)
|
|
||||||
{
|
|
||||||
Json::Value ret (Json::objectValue);
|
|
||||||
ret["account"] = mAccount.humanAccountID ();
|
|
||||||
ret["taker_gets"] = getTakerGets ().getFullText ();
|
|
||||||
ret["taker_pays"] = getTakerPays ().getFullText ();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
@@ -1,71 +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_OFFER_H
|
|
||||||
#define RIPPLE_OFFER_H
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
|
|
||||||
class Offer : public AccountItem
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Offer () {}
|
|
||||||
|
|
||||||
virtual ~Offer () {}
|
|
||||||
|
|
||||||
AccountItem::pointer makeItem (
|
|
||||||
Account const&, SerializedLedgerEntry::ref ledgerEntry);
|
|
||||||
|
|
||||||
LedgerEntryType getType ()
|
|
||||||
{
|
|
||||||
return (ltOFFER);
|
|
||||||
}
|
|
||||||
|
|
||||||
STAmount const& getTakerPays ()
|
|
||||||
{
|
|
||||||
return (mTakerPays);
|
|
||||||
}
|
|
||||||
STAmount const& getTakerGets ()
|
|
||||||
{
|
|
||||||
return (mTakerGets);
|
|
||||||
}
|
|
||||||
RippleAddress const& getAccount ()
|
|
||||||
{
|
|
||||||
return (mAccount);
|
|
||||||
}
|
|
||||||
int getSeq ()
|
|
||||||
{
|
|
||||||
return (mSeq);
|
|
||||||
}
|
|
||||||
Json::Value getJson (int);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// For accounts in a ledger
|
|
||||||
explicit Offer (SerializedLedgerEntry::pointer ledgerEntry);
|
|
||||||
|
|
||||||
private:
|
|
||||||
RippleAddress mAccount;
|
|
||||||
STAmount mTakerGets;
|
|
||||||
STAmount mTakerPays;
|
|
||||||
int mSeq;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -431,7 +431,7 @@ CurrencySet usAccountSourceCurrencies (
|
|||||||
// List of ripple lines.
|
// List of ripple lines.
|
||||||
auto& rippleLines (lrCache->getRippleLines (raAccountID.getAccountID ()));
|
auto& rippleLines (lrCache->getRippleLines (raAccountID.getAccountID ()));
|
||||||
|
|
||||||
for (auto const& item: rippleLines.getItems ())
|
for (auto const& item : rippleLines)
|
||||||
{
|
{
|
||||||
auto rspEntry = (RippleState*) item.get ();
|
auto rspEntry = (RippleState*) item.get ();
|
||||||
auto& saBalance = rspEntry->getBalance ();
|
auto& saBalance = rspEntry->getBalance ();
|
||||||
@@ -465,7 +465,7 @@ CurrencySet usAccountDestCurrencies (
|
|||||||
// List of ripple lines.
|
// List of ripple lines.
|
||||||
auto& rippleLines (lrCache->getRippleLines (raAccountID.getAccountID ()));
|
auto& rippleLines (lrCache->getRippleLines (raAccountID.getAccountID ()));
|
||||||
|
|
||||||
for (auto item: rippleLines.getItems ())
|
for (auto const& item : rippleLines)
|
||||||
{
|
{
|
||||||
RippleState* rspEntry = (RippleState*) item.get ();
|
RippleState* rspEntry = (RippleState*) item.get ();
|
||||||
STAmount const& saBalance = rspEntry->getBalance ();
|
STAmount const& saBalance = rspEntry->getBalance ();
|
||||||
@@ -513,8 +513,8 @@ int Pathfinder::getPathsOut (
|
|||||||
if (!bFrozen)
|
if (!bFrozen)
|
||||||
{
|
{
|
||||||
count = getApp().getOrderBookDB().getBookSize({currencyID, accountID});
|
count = getApp().getOrderBookDB().getBookSize({currencyID, accountID});
|
||||||
AccountItems& rippleLines = mRLCache->getRippleLines (accountID);
|
|
||||||
for (auto const& item : rippleLines.getItems ())
|
for (auto const& item : mRLCache->getRippleLines (accountID))
|
||||||
{
|
{
|
||||||
RippleState* rspEntry = (RippleState*) item.get ();
|
RippleState* rspEntry = (RippleState*) item.get ();
|
||||||
|
|
||||||
@@ -704,9 +704,9 @@ void Pathfinder::addLink(
|
|||||||
auto& rippleLines (mRLCache->getRippleLines(uEndAccount));
|
auto& rippleLines (mRLCache->getRippleLines(uEndAccount));
|
||||||
|
|
||||||
AccountCandidates candidates;
|
AccountCandidates candidates;
|
||||||
candidates.reserve(rippleLines.getItems().size());
|
candidates.reserve(rippleLines.size());
|
||||||
|
|
||||||
for(auto const& item : rippleLines.getItems())
|
for(auto const& item : rippleLines)
|
||||||
{
|
{
|
||||||
auto* rs = dynamic_cast<RippleState const *> (item.get());
|
auto* rs = dynamic_cast<RippleState const *> (item.get());
|
||||||
if (!rs)
|
if (!rs)
|
||||||
|
|||||||
@@ -24,19 +24,18 @@ RippleLineCache::RippleLineCache (Ledger::ref l)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountItems& RippleLineCache::getRippleLines (Account const& accountID)
|
std::vector<RippleState::pointer> const&
|
||||||
|
RippleLineCache::getRippleLines (Account const& accountID)
|
||||||
{
|
{
|
||||||
ScopedLockType sl (mLock);
|
ScopedLockType sl (mLock);
|
||||||
|
|
||||||
auto it = mRLMap.find (accountID);
|
auto it = mRLMap.find (accountID);
|
||||||
|
|
||||||
if (it == mRLMap.end ())
|
if (it == mRLMap.end ())
|
||||||
{
|
it = mRLMap.insert (std::make_pair (
|
||||||
auto accountItems = std::make_shared<AccountItems> (
|
accountID, ripple::getRippleStateItems (accountID, mLedger))).first;
|
||||||
accountID, mLedger, AccountItem::pointer (new RippleState ()));
|
|
||||||
it = mRLMap.insert ({accountID, accountItems}).first;
|
return it->second;
|
||||||
}
|
|
||||||
return *it->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ public:
|
|||||||
return mLedger;
|
return mLedger;
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountItems& getRippleLines (Account const& accountID);
|
std::vector<RippleState::pointer> const&
|
||||||
|
getRippleLines (Account const& accountID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef RippleMutex LockType;
|
typedef RippleMutex LockType;
|
||||||
@@ -45,7 +46,7 @@ private:
|
|||||||
|
|
||||||
Ledger::pointer mLedger;
|
Ledger::pointer mLedger;
|
||||||
|
|
||||||
hash_map <Account, AccountItems::pointer> mRLMap;
|
hash_map <Account, std::vector <RippleState::pointer>> mRLMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -19,30 +19,24 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
AccountItem::pointer RippleState::makeItem (
|
RippleState::pointer RippleState::makeItem (
|
||||||
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry)
|
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry)
|
||||||
{
|
{
|
||||||
if (!ledgerEntry || ledgerEntry->getType () != ltRIPPLE_STATE)
|
if (!ledgerEntry || ledgerEntry->getType () != ltRIPPLE_STATE)
|
||||||
return AccountItem::pointer ();
|
return pointer ();
|
||||||
|
|
||||||
RippleState* rs = new RippleState (ledgerEntry);
|
return pointer (new RippleState (ledgerEntry, accountID));
|
||||||
rs->setViewAccount (accountID);
|
|
||||||
|
|
||||||
return AccountItem::pointer (rs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RippleState::RippleState (SerializedLedgerEntry::ref ledgerEntry)
|
RippleState::RippleState (
|
||||||
: AccountItem (ledgerEntry),
|
SerializedLedgerEntry::ref ledgerEntry,
|
||||||
mValid (false),
|
Account const& viewAccount)
|
||||||
mViewLowest (true),
|
: mLedgerEntry (ledgerEntry)
|
||||||
|
, mLowLimit (ledgerEntry->getFieldAmount (sfLowLimit))
|
||||||
mLowLimit (ledgerEntry->getFieldAmount (sfLowLimit)),
|
, mHighLimit (ledgerEntry->getFieldAmount (sfHighLimit))
|
||||||
mHighLimit (ledgerEntry->getFieldAmount (sfHighLimit)),
|
, mLowID (mLowLimit.getIssuer ())
|
||||||
|
, mHighID (mHighLimit.getIssuer ())
|
||||||
mLowID (mLowLimit.getIssuer ()),
|
, mBalance (ledgerEntry->getFieldAmount (sfBalance))
|
||||||
mHighID (mHighLimit.getIssuer ()),
|
|
||||||
|
|
||||||
mBalance (ledgerEntry->getFieldAmount (sfBalance))
|
|
||||||
{
|
{
|
||||||
mFlags = mLedgerEntry->getFieldU32 (sfFlags);
|
mFlags = mLedgerEntry->getFieldU32 (sfFlags);
|
||||||
|
|
||||||
@@ -52,18 +46,10 @@ RippleState::RippleState (SerializedLedgerEntry::ref ledgerEntry)
|
|||||||
mHighQualityIn = mLedgerEntry->getFieldU32 (sfHighQualityIn);
|
mHighQualityIn = mLedgerEntry->getFieldU32 (sfHighQualityIn);
|
||||||
mHighQualityOut = mLedgerEntry->getFieldU32 (sfHighQualityOut);
|
mHighQualityOut = mLedgerEntry->getFieldU32 (sfHighQualityOut);
|
||||||
|
|
||||||
mValid = true;
|
mViewLowest = (mLowID == viewAccount);
|
||||||
}
|
|
||||||
|
|
||||||
void RippleState::setViewAccount (Account const& accountID)
|
if (!mViewLowest)
|
||||||
{
|
|
||||||
bool bViewLowestNew = mLowID == accountID;
|
|
||||||
|
|
||||||
if (bViewLowestNew != mViewLowest)
|
|
||||||
{
|
|
||||||
mViewLowest = bViewLowestNew;
|
|
||||||
mBalance.negate ();
|
mBalance.negate ();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value RippleState::getJson (int)
|
Json::Value RippleState::getJson (int)
|
||||||
@@ -74,4 +60,23 @@ Json::Value RippleState::getJson (int)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector <RippleState::pointer>
|
||||||
|
getRippleStateItems (
|
||||||
|
Account const& accountID,
|
||||||
|
Ledger::ref ledger)
|
||||||
|
{
|
||||||
|
std::vector <RippleState::pointer> items;
|
||||||
|
|
||||||
|
ledger->visitAccountItems (accountID,
|
||||||
|
[&items,&accountID](SLE::ref sleCur)
|
||||||
|
{
|
||||||
|
auto ret = RippleState::makeItem (accountID, sleCur);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
items.push_back (ret);
|
||||||
|
});
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -27,17 +27,17 @@ namespace ripple {
|
|||||||
// - Isolate ledger entry format.
|
// - Isolate ledger entry format.
|
||||||
//
|
//
|
||||||
|
|
||||||
class RippleState : public AccountItem
|
class RippleState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::shared_ptr <RippleState> pointer;
|
typedef std::shared_ptr <RippleState> pointer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RippleState () { }
|
RippleState () = delete;
|
||||||
|
|
||||||
virtual ~RippleState () { }
|
virtual ~RippleState () { }
|
||||||
|
|
||||||
AccountItem::pointer makeItem (
|
static RippleState::pointer makeItem (
|
||||||
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry);
|
Account const& accountID, SerializedLedgerEntry::ref ledgerEntry);
|
||||||
|
|
||||||
LedgerEntryType getType ()
|
LedgerEntryType getType ()
|
||||||
@@ -45,8 +45,6 @@ public:
|
|||||||
return ltRIPPLE_STATE;
|
return ltRIPPLE_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setViewAccount (Account const& accountID);
|
|
||||||
|
|
||||||
Account const& getAccountID () const
|
Account const& getAccountID () const
|
||||||
{
|
{
|
||||||
return mViewLowest ? mLowID : mHighID;
|
return mViewLowest ? mLowID : mHighID;
|
||||||
@@ -136,19 +134,22 @@ public:
|
|||||||
Blob getRaw () const;
|
Blob getRaw () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit RippleState (SerializedLedgerEntry::ref ledgerEntry); // For accounts in a ledger
|
RippleState (
|
||||||
|
SerializedLedgerEntry::ref ledgerEntry,
|
||||||
|
Account const& viewAccount);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mValid;
|
SerializedLedgerEntry::pointer mLedgerEntry;
|
||||||
|
|
||||||
bool mViewLowest;
|
bool mViewLowest;
|
||||||
|
|
||||||
std::uint32_t mFlags;
|
std::uint32_t mFlags;
|
||||||
|
|
||||||
STAmount mLowLimit;
|
STAmount const& mLowLimit;
|
||||||
STAmount mHighLimit;
|
STAmount const& mHighLimit;
|
||||||
|
|
||||||
Account mLowID;
|
Account const& mLowID;
|
||||||
Account mHighID;
|
Account const& mHighID;
|
||||||
|
|
||||||
std::uint64_t mLowQualityIn;
|
std::uint64_t mLowQualityIn;
|
||||||
std::uint64_t mLowQualityOut;
|
std::uint64_t mLowQualityOut;
|
||||||
@@ -158,6 +159,11 @@ private:
|
|||||||
STAmount mBalance;
|
STAmount mBalance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::vector <RippleState::pointer>
|
||||||
|
getRippleStateItems (
|
||||||
|
Account const& accountID,
|
||||||
|
Ledger::ref ledger);
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ Json::Value doAccountCurrencies (RPC::Context& context)
|
|||||||
return jvAccepted;
|
return jvAccepted;
|
||||||
|
|
||||||
std::set<Currency> send, receive;
|
std::set<Currency> send, receive;
|
||||||
AccountItems rippleLines (
|
for (auto const& item : getRippleStateItems (naAccount.getAccountID (), ledger))
|
||||||
naAccount.getAccountID (), ledger,
|
|
||||||
AccountItem::pointer (new RippleState ()));
|
|
||||||
for (auto item: rippleLines.getItems ())
|
|
||||||
{
|
{
|
||||||
RippleState* rspEntry = (RippleState*) item.get ();
|
RippleState* rspEntry = (RippleState*) item.get ();
|
||||||
STAmount const& saBalance = rspEntry->getBalance ();
|
STAmount const& saBalance = rspEntry->getBalance ();
|
||||||
|
|||||||
@@ -75,14 +75,10 @@ Json::Value doAccountLines (RPC::Context& context)
|
|||||||
|
|
||||||
if (ledger->hasAccount (raAccount))
|
if (ledger->hasAccount (raAccount))
|
||||||
{
|
{
|
||||||
AccountItems rippleLines (raAccount.getAccountID (), ledger,
|
|
||||||
AccountItem::pointer (new RippleState ()));
|
|
||||||
|
|
||||||
result[jss::account] = raAccount.humanAccountID ();
|
result[jss::account] = raAccount.humanAccountID ();
|
||||||
Json::Value& jsonLines = (result[jss::lines] = Json::arrayValue);
|
Json::Value& jsonLines = (result[jss::lines] = Json::arrayValue);
|
||||||
|
|
||||||
|
for (auto const& item : getRippleStateItems (raAccount.getAccountID (), ledger))
|
||||||
for (auto& item: rippleLines.getItems ())
|
|
||||||
{
|
{
|
||||||
RippleState* line = (RippleState*)item.get ();
|
RippleState* line = (RippleState*)item.get ();
|
||||||
|
|
||||||
|
|||||||
@@ -89,8 +89,6 @@
|
|||||||
#include <ripple/module/app/peers/PeerSet.h>
|
#include <ripple/module/app/peers/PeerSet.h>
|
||||||
#include <ripple/module/app/ledger/InboundLedger.h>
|
#include <ripple/module/app/ledger/InboundLedger.h>
|
||||||
#include <ripple/module/app/ledger/InboundLedgers.h>
|
#include <ripple/module/app/ledger/InboundLedgers.h>
|
||||||
#include <ripple/module/app/misc/AccountItem.h>
|
|
||||||
#include <ripple/module/app/misc/AccountItems.h>
|
|
||||||
#include <ripple/module/app/ledger/AcceptedLedgerTx.h>
|
#include <ripple/module/app/ledger/AcceptedLedgerTx.h>
|
||||||
#include <ripple/module/app/ledger/AcceptedLedger.h>
|
#include <ripple/module/app/ledger/AcceptedLedger.h>
|
||||||
#include <ripple/module/app/ledger/LedgerEntrySet.h>
|
#include <ripple/module/app/ledger/LedgerEntrySet.h>
|
||||||
@@ -113,15 +111,14 @@
|
|||||||
#include <ripple/module/app/consensus/DisputedTx.h>
|
#include <ripple/module/app/consensus/DisputedTx.h>
|
||||||
#include <ripple/module/app/consensus/LedgerConsensus.h>
|
#include <ripple/module/app/consensus/LedgerConsensus.h>
|
||||||
#include <ripple/module/app/ledger/LedgerTiming.h>
|
#include <ripple/module/app/ledger/LedgerTiming.h>
|
||||||
#include <ripple/module/app/misc/Offer.h>
|
#include <ripple/module/app/paths/RippleState.h>
|
||||||
#include <ripple/module/app/paths/RippleLineCache.h>
|
#include <ripple/module/app/paths/RippleLineCache.h>
|
||||||
#include <ripple/module/app/paths/PathRequest.h>
|
#include <ripple/module/app/paths/PathRequest.h>
|
||||||
#include <ripple/module/app/paths/PathRequests.h>
|
#include <ripple/module/app/paths/PathRequests.h>
|
||||||
#include <ripple/module/app/main/ParameterTable.h>
|
#include <ripple/module/app/main/ParameterTable.h>
|
||||||
#include <ripple/module/app/paths/RippleLineCache.h>
|
|
||||||
#include <ripple/module/app/paths/PathState.h>
|
#include <ripple/module/app/paths/PathState.h>
|
||||||
#include <ripple/module/app/paths/RippleCalc.h>
|
#include <ripple/module/app/paths/RippleCalc.h>
|
||||||
#include <ripple/module/app/paths/Pathfinder.h>
|
#include <ripple/module/app/paths/Pathfinder.h>
|
||||||
#include <ripple/module/app/paths/RippleState.h>
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include <ripple/module/app/shamap/SHAMapSync.cpp>
|
#include <ripple/module/app/shamap/SHAMapSync.cpp>
|
||||||
#include <ripple/module/app/shamap/SHAMapMissingNode.cpp>
|
#include <ripple/module/app/shamap/SHAMapMissingNode.cpp>
|
||||||
|
|
||||||
#include <ripple/module/app/misc/AccountItem.cpp>
|
|
||||||
#include <ripple/module/app/misc/CanonicalTXSet.cpp>
|
#include <ripple/module/app/misc/CanonicalTXSet.cpp>
|
||||||
#include <ripple/module/app/ledger/LedgerProposal.cpp>
|
#include <ripple/module/app/ledger/LedgerProposal.cpp>
|
||||||
#include <ripple/module/app/main/LoadManager.cpp>
|
#include <ripple/module/app/main/LoadManager.cpp>
|
||||||
|
|||||||
@@ -25,5 +25,4 @@
|
|||||||
#include <ripple/module/app/shamap/SHAMapDelta.cpp>
|
#include <ripple/module/app/shamap/SHAMapDelta.cpp>
|
||||||
#include <ripple/module/app/shamap/SHAMapNodeID.cpp>
|
#include <ripple/module/app/shamap/SHAMapNodeID.cpp>
|
||||||
#include <ripple/module/app/shamap/SHAMapTreeNode.cpp>
|
#include <ripple/module/app/shamap/SHAMapTreeNode.cpp>
|
||||||
#include <ripple/module/app/misc/AccountItems.cpp>
|
|
||||||
#include <ripple/module/app/misc/AccountState.cpp>
|
#include <ripple/module/app/misc/AccountState.cpp>
|
||||||
|
|||||||
@@ -29,6 +29,5 @@
|
|||||||
#include <ripple/module/app/ledger/OrderBookIterator.cpp>
|
#include <ripple/module/app/ledger/OrderBookIterator.cpp>
|
||||||
#include <ripple/module/app/consensus/DisputedTx.cpp>
|
#include <ripple/module/app/consensus/DisputedTx.cpp>
|
||||||
#include <ripple/module/app/misc/HashRouter.cpp>
|
#include <ripple/module/app/misc/HashRouter.cpp>
|
||||||
#include <ripple/module/app/misc/Offer.cpp>
|
|
||||||
#include <ripple/module/app/paths/Pathfinder.cpp>
|
#include <ripple/module/app/paths/Pathfinder.cpp>
|
||||||
#include <ripple/module/app/misc/AmendmentTableImpl.cpp>
|
#include <ripple/module/app/misc/AmendmentTableImpl.cpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user