diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 5f8812c49b..d4d07eee94 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -32,6 +32,14 @@ libxrpl.server > xrpl.server libxrpl.shamap > xrpl.basics libxrpl.shamap > xrpl.protocol libxrpl.shamap > xrpl.shamap +libxrpl.tx > xrpl.basics +libxrpl.tx > xrpl.conditions +libxrpl.tx > xrpl.core +libxrpl.tx > xrpl.json +libxrpl.tx > xrpl.ledger +libxrpl.tx > xrpl.protocol +libxrpl.tx > xrpl.server +libxrpl.tx > xrpl.tx test.app > test.jtx test.app > test.rpc test.app > test.toplevel @@ -49,6 +57,7 @@ test.app > xrpl.protocol test.app > xrpl.rdb test.app > xrpl.resource test.app > xrpl.server +test.app > xrpl.tx test.basics > test.jtx test.basics > test.unit_test test.basics > xrpl.basics @@ -67,6 +76,7 @@ test.consensus > xrpld.app test.consensus > xrpld.consensus test.consensus > xrpl.json test.consensus > xrpl.ledger +test.consensus > xrpl.tx test.core > test.jtx test.core > test.toplevel test.core > test.unit_test @@ -83,6 +93,7 @@ test.csf > xrpl.protocol test.json > test.jtx test.json > xrpl.json test.jtx > xrpl.basics +test.jtx > xrpl.core test.jtx > xrpld.app test.jtx > xrpld.core test.jtx > xrpld.rpc @@ -92,6 +103,7 @@ test.jtx > xrpl.net test.jtx > xrpl.protocol test.jtx > xrpl.resource test.jtx > xrpl.server +test.jtx > xrpl.tx test.ledger > test.jtx test.ledger > test.toplevel test.ledger > xrpl.basics @@ -137,9 +149,11 @@ test.rpc > xrpld.core test.rpc > xrpld.overlay test.rpc > xrpld.rpc test.rpc > xrpl.json +test.rpc > xrpl.ledger test.rpc > xrpl.protocol test.rpc > xrpl.resource test.rpc > xrpl.server +test.rpc > xrpl.tx test.server > test.jtx test.server > test.toplevel test.server > test.unit_test @@ -170,6 +184,7 @@ xrpl.json > xrpl.basics xrpl.ledger > xrpl.basics xrpl.ledger > xrpl.protocol xrpl.ledger > xrpl.server +xrpl.ledger > xrpl.shamap xrpl.net > xrpl.basics xrpl.nodestore > xrpl.basics xrpl.nodestore > xrpl.protocol @@ -191,9 +206,12 @@ xrpl.server > xrpl.shamap xrpl.shamap > xrpl.basics xrpl.shamap > xrpl.nodestore xrpl.shamap > xrpl.protocol +xrpl.tx > xrpl.basics +xrpl.tx > xrpl.core +xrpl.tx > xrpl.ledger +xrpl.tx > xrpl.protocol xrpld.app > test.unit_test xrpld.app > xrpl.basics -xrpld.app > xrpl.conditions xrpld.app > xrpl.core xrpld.app > xrpld.consensus xrpld.app > xrpld.core @@ -206,6 +224,7 @@ xrpld.app > xrpl.rdb xrpld.app > xrpl.resource xrpld.app > xrpl.server xrpld.app > xrpl.shamap +xrpld.app > xrpl.tx xrpld.consensus > xrpl.basics xrpld.consensus > xrpl.json xrpld.consensus > xrpl.protocol @@ -224,6 +243,7 @@ xrpld.overlay > xrpl.protocol xrpld.overlay > xrpl.rdb xrpld.overlay > xrpl.resource xrpld.overlay > xrpl.server +xrpld.overlay > xrpl.tx xrpld.peerfinder > xrpl.basics xrpld.peerfinder > xrpld.core xrpld.peerfinder > xrpl.protocol @@ -243,4 +263,5 @@ xrpld.rpc > xrpl.protocol xrpld.rpc > xrpl.rdb xrpld.rpc > xrpl.resource xrpld.rpc > xrpl.server +xrpld.rpc > xrpl.tx xrpld.shamap > xrpl.shamap diff --git a/.gitignore b/.gitignore index 2692d707e7..a1c2f034d1 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ DerivedData /.augment /.claude /CLAUDE.md + +# clangd cache +/.cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79a3e4e7ec..9117fe0d3e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: args: [--assume-in-merge] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: 7d85583be209cb547946c82fbe51f4bc5dd1d017 # frozen: v18.1.8 + rev: 75ca4ad908dc4a99f57921f29b7e6c1521e10b26 # frozen: v21.1.8 hooks: - id: clang-format args: [--style=file] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 808d553e17..a928065ef2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -219,7 +219,7 @@ coherent rather than a set of _thou shalt not_ commandments. ## Formatting -All code must conform to `clang-format` version 18, +All code must conform to `clang-format` version 21, according to the settings in [`.clang-format`](./.clang-format), unless the result would be unreasonably difficult to read or maintain. To demarcate lines that should be left as-is, surround them with comments like diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 3380ca85cd..9a847bfcb9 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -109,8 +109,12 @@ target_link_libraries( xrpl.libxrpl.protocol xrpl.libxrpl.rdb xrpl.libxrpl.server + xrpl.libxrpl.shamap xrpl.libxrpl.conditions) +add_module(xrpl tx) +target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger) + add_library(xrpl.libxrpl) set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl) @@ -135,7 +139,8 @@ target_link_modules( rdb resource server - shamap) + shamap + tx) # All headers in libxrpl are in modules. # Uncomment this stanza if you have not yet moved new headers into a module. diff --git a/cmake/XrplInstall.cmake b/cmake/XrplInstall.cmake index d2fef5d488..b8cf4fd32f 100644 --- a/cmake/XrplInstall.cmake +++ b/cmake/XrplInstall.cmake @@ -32,6 +32,7 @@ install(TARGETS common xrpl.libxrpl.resource xrpl.libxrpl.server xrpl.libxrpl.shamap + xrpl.libxrpl.tx antithesis-sdk-cpp EXPORT XrplExports LIBRARY DESTINATION lib diff --git a/include/xrpl/basics/IntrusivePointer.ipp b/include/xrpl/basics/IntrusivePointer.ipp index d52aa6299f..de57e61ba6 100644 --- a/include/xrpl/basics/IntrusivePointer.ipp +++ b/include/xrpl/basics/IntrusivePointer.ipp @@ -208,7 +208,8 @@ SharedIntrusive::operator->() const noexcept } template -SharedIntrusive::operator bool() const noexcept +SharedIntrusive:: +operator bool() const noexcept { return bool(unsafeGetRawPtr()); } @@ -503,7 +504,8 @@ SharedWeakUnion::getStrong() const } template -SharedWeakUnion::operator bool() const noexcept +SharedWeakUnion:: +operator bool() const noexcept { return bool(get()); } diff --git a/include/xrpl/basics/SharedWeakCachePointer.ipp b/include/xrpl/basics/SharedWeakCachePointer.ipp index 6e7514ffae..7eb3789de5 100644 --- a/include/xrpl/basics/SharedWeakCachePointer.ipp +++ b/include/xrpl/basics/SharedWeakCachePointer.ipp @@ -63,7 +63,8 @@ SharedWeakCachePointer::getStrong() const } template -SharedWeakCachePointer::operator bool() const noexcept +SharedWeakCachePointer:: +operator bool() const noexcept { return !!std::get_if>(&combo_); } diff --git a/include/xrpl/basics/SlabAllocator.h b/include/xrpl/basics/SlabAllocator.h index 2578afdc5a..84beef2d20 100644 --- a/include/xrpl/basics/SlabAllocator.h +++ b/include/xrpl/basics/SlabAllocator.h @@ -215,7 +215,7 @@ public: // clang-format off if (!buf) [[unlikely]] return nullptr; - // clang-format on + // clang-format on #if BOOST_OS_LINUX // When allocating large blocks, attempt to leverage Linux's diff --git a/include/xrpl/core/NetworkIDService.h b/include/xrpl/core/NetworkIDService.h new file mode 100644 index 0000000000..d12fa42055 --- /dev/null +++ b/include/xrpl/core/NetworkIDService.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +namespace xrpl { + +/** Service that provides access to the network ID. + + This service provides read-only access to the network ID configured + for this server. The network ID identifies which network (mainnet, + testnet, devnet, or custom network) this server is configured to + connect to. + + Well-known network IDs: + - 0: Mainnet + - 1: Testnet + - 2: Devnet + - 1025+: Custom networks (require NetworkID field in transactions) +*/ +class NetworkIDService +{ +public: + virtual ~NetworkIDService() = default; + + /** Get the configured network ID + * + * @return The network ID this server is configured for + */ + virtual std::uint32_t + getNetworkID() const noexcept = 0; +}; + +} // namespace xrpl diff --git a/include/xrpl/core/ServiceRegistry.h b/include/xrpl/core/ServiceRegistry.h index fabf61f9e4..1a2e33d5ee 100644 --- a/include/xrpl/core/ServiceRegistry.h +++ b/include/xrpl/core/ServiceRegistry.h @@ -41,6 +41,7 @@ class LoadFeeTrack; class LoadManager; class ManifestCache; class NetworkOPs; +class NetworkIDService; class OpenLedger; class OrderBookDB; class Overlay; @@ -99,6 +100,9 @@ public: virtual CachedSLEs& cachedSLEs() = 0; + virtual NetworkIDService& + getNetworkIDService() = 0; + // Protocol and validation services virtual AmendmentTable& getAmendmentTable() = 0; diff --git a/src/xrpld/app/misc/AmendmentTable.h b/include/xrpl/ledger/AmendmentTable.h similarity index 97% rename from src/xrpld/app/misc/AmendmentTable.h rename to include/xrpl/ledger/AmendmentTable.h index bfef818b0a..017fcd3846 100644 --- a/src/xrpld/app/misc/AmendmentTable.h +++ b/include/xrpl/ledger/AmendmentTable.h @@ -1,17 +1,18 @@ #pragma once -#include -#include - -#include +#include +#include #include #include #include +#include #include namespace xrpl { +class ServiceRegistry; + /** The amendment table stores the list of enabled and potential amendments. Individuals amendments are voted on by validators during the consensus process. diff --git a/include/xrpl/protocol/Feature.h b/include/xrpl/protocol/Feature.h index 6d674fbef2..34d78fc50b 100644 --- a/include/xrpl/protocol/Feature.h +++ b/include/xrpl/protocol/Feature.h @@ -296,7 +296,7 @@ public: friend FeatureBitset operator^(FeatureBitset const& lhs, uint256 const& rhs) { - return lhs ^ FeatureBitset { rhs }; + return lhs ^ FeatureBitset{rhs}; } friend FeatureBitset diff --git a/include/xrpl/protocol/IOUAmount.h b/include/xrpl/protocol/IOUAmount.h index 52c2272da0..608c80d982 100644 --- a/include/xrpl/protocol/IOUAmount.h +++ b/include/xrpl/protocol/IOUAmount.h @@ -110,7 +110,8 @@ IOUAmount::operator=(beast::Zero) return *this; } -inline IOUAmount::operator Number() const +inline IOUAmount:: +operator Number() const { return Number{mantissa_, exponent_}; } @@ -140,7 +141,8 @@ IOUAmount::operator<(IOUAmount const& other) const return Number{*this} < Number{other}; } -inline IOUAmount::operator bool() const noexcept +inline IOUAmount:: +operator bool() const noexcept { return mantissa_ != 0; } diff --git a/include/xrpl/protocol/MPTAmount.h b/include/xrpl/protocol/MPTAmount.h index 66027185b3..5c1642ae5c 100644 --- a/include/xrpl/protocol/MPTAmount.h +++ b/include/xrpl/protocol/MPTAmount.h @@ -93,7 +93,8 @@ MPTAmount::operator=(beast::Zero) } /** Returns true if the amount is not zero */ -constexpr MPTAmount::operator bool() const noexcept +constexpr MPTAmount:: +operator bool() const noexcept { return value_ != 0; } diff --git a/include/xrpl/protocol/MultiApiJson.h b/include/xrpl/protocol/MultiApiJson.h index ad7a6b8f0d..b884771b50 100644 --- a/include/xrpl/protocol/MultiApiJson.h +++ b/include/xrpl/protocol/MultiApiJson.h @@ -107,7 +107,7 @@ struct MultiApiJson // unsigned int version, extra arguments template requires(!some_integral_constant) && std::convertible_to && - std::same_as, MultiApiJson> + std::same_as, MultiApiJson> auto operator()(Json& json, Version version, Fn fn, Args&&... args) const -> std::invoke_result_t @@ -122,7 +122,7 @@ struct MultiApiJson // unsigned int version, Json only template requires(!some_integral_constant) && std::convertible_to && - std::same_as, MultiApiJson> + std::same_as, MultiApiJson> auto operator()(Json& json, Version version, Fn fn) const -> std::invoke_result_t { diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index dfb2b9dfe8..2879aecda9 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -253,6 +253,16 @@ std::uint8_t constexpr maxAssetCheckDepth = 5; /** A ledger index. */ using LedgerIndex = std::uint32_t; +std::uint32_t constexpr FLAG_LEDGER_INTERVAL = 256; + +/** Returns true if the given ledgerIndex is a voting ledgerIndex */ +bool +isVotingLedger(LedgerIndex seq); + +/** Returns true if the given ledgerIndex is a flag ledgerIndex */ +bool +isFlagLedger(LedgerIndex seq); + /** A transaction identifier. The value is computed as the hash of the canonicalized, serialized transaction object. diff --git a/include/xrpl/protocol/STAmount.h b/include/xrpl/protocol/STAmount.h index df2b1c19a0..ea727d02e3 100644 --- a/include/xrpl/protocol/STAmount.h +++ b/include/xrpl/protocol/STAmount.h @@ -480,12 +480,14 @@ STAmount::zeroed() const return STAmount(mAsset); } -inline STAmount::operator bool() const noexcept +inline STAmount:: +operator bool() const noexcept { return *this != beast::zero; } -inline STAmount::operator Number() const +inline STAmount:: +operator Number() const { if (native()) return xrp(); diff --git a/include/xrpl/protocol/STBitString.h b/include/xrpl/protocol/STBitString.h index e8b6e7282b..dca2670ffc 100644 --- a/include/xrpl/protocol/STBitString.h +++ b/include/xrpl/protocol/STBitString.h @@ -169,7 +169,8 @@ STBitString::value() const } template -STBitString::operator value_type() const +STBitString:: +operator value_type() const { return value_; } diff --git a/include/xrpl/protocol/STInteger.h b/include/xrpl/protocol/STInteger.h index b5c4dbf6cf..f4bbd6e73d 100644 --- a/include/xrpl/protocol/STInteger.h +++ b/include/xrpl/protocol/STInteger.h @@ -134,7 +134,8 @@ STInteger::setValue(Integer v) } template -inline STInteger::operator Integer() const +inline STInteger:: +operator Integer() const { return value_; } diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 5d5d829c99..c9102f2470 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -147,9 +147,12 @@ public: int getCount() const; - bool setFlag(std::uint32_t); - bool clearFlag(std::uint32_t); - bool isFlag(std::uint32_t) const; + bool + setFlag(std::uint32_t); + bool + clearFlag(std::uint32_t); + bool + isFlag(std::uint32_t) const; std::uint32_t getFlags() const; @@ -799,7 +802,8 @@ STObject::ValueProxy::operator-=(U const& u) } template -STObject::ValueProxy::operator value_type() const +STObject::ValueProxy:: +operator value_type() const { return this->value(); } @@ -812,13 +816,15 @@ STObject::ValueProxy::ValueProxy(STObject* st, TypedField const* f) : Prox //------------------------------------------------------------------------------ template -STObject::OptionalProxy::operator bool() const noexcept +STObject::OptionalProxy:: +operator bool() const noexcept { return engaged(); } template -STObject::OptionalProxy::operator typename STObject::OptionalProxy::optional_type() const +STObject::OptionalProxy:: +operator typename STObject::OptionalProxy::optional_type() const { return optional_value(); } diff --git a/include/xrpl/protocol/STVector256.h b/include/xrpl/protocol/STVector256.h index c83d981bfc..8e63953e22 100644 --- a/include/xrpl/protocol/STVector256.h +++ b/include/xrpl/protocol/STVector256.h @@ -135,7 +135,8 @@ STVector256::setValue(STVector256 const& v) } /** Retrieve a copy of the vector we contain */ -inline STVector256::operator std::vector() const +inline STVector256:: +operator std::vector() const { return mValue; } diff --git a/include/xrpl/protocol/TER.h b/include/xrpl/protocol/TER.h index 52001ce72b..3c1faccf6d 100644 --- a/include/xrpl/protocol/TER.h +++ b/include/xrpl/protocol/TER.h @@ -484,60 +484,54 @@ public: // Only enabled if both arguments return int if TERtiInt is called with them. template constexpr auto -operator==(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator==(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) == TERtoInt(rhs); } template constexpr auto -operator!=(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator!=(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) != TERtoInt(rhs); } template constexpr auto -operator<(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator<(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) < TERtoInt(rhs); } template constexpr auto -operator<=(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator<=(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) <= TERtoInt(rhs); } template constexpr auto -operator>(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator>(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) > TERtoInt(rhs); } template constexpr auto -operator>=(L const& lhs, R const& rhs) - -> std::enable_if_t< - std::is_same::value && std::is_same::value, - bool> +operator>=(L const& lhs, R const& rhs) -> std::enable_if_t< + std::is_same::value && std::is_same::value, + bool> { return TERtoInt(lhs) >= TERtoInt(rhs); } diff --git a/include/xrpl/protocol/detail/transactions.macro b/include/xrpl/protocol/detail/transactions.macro index bc7eefedb5..b696a1d1c2 100644 --- a/include/xrpl/protocol/detail/transactions.macro +++ b/include/xrpl/protocol/detail/transactions.macro @@ -8,11 +8,11 @@ * To ease maintenance, you may replace any unneeded values with "..." * e.g. #define TRANSACTION(tag, value, name, ...) * - * You must define a transactor class in the `ripple` namespace named `name`, + * You must define a transactor class in the `xrpl` namespace named `name`, * and include its header alongside the TRANSACTOR definition using this * format: * #if TRANSACTION_INCLUDE - * # include + * # include * #endif * * The `privileges` parameter of the TRANSACTION macro is a bitfield @@ -22,7 +22,7 @@ /** This transaction type executes a payment. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPAYMENT, 0, Payment, Delegation::delegable, @@ -42,7 +42,7 @@ TRANSACTION(ttPAYMENT, 0, Payment, /** This transaction type creates an escrow object. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttESCROW_CREATE, 1, EscrowCreate, Delegation::delegable, @@ -73,7 +73,7 @@ TRANSACTION(ttESCROW_FINISH, 2, EscrowFinish, /** This transaction type adjusts various account settings. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttACCOUNT_SET, 3, AccountSet, Delegation::notDelegable, @@ -94,7 +94,7 @@ TRANSACTION(ttACCOUNT_SET, 3, AccountSet, /** This transaction type cancels an existing escrow. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, Delegation::delegable, @@ -107,7 +107,7 @@ TRANSACTION(ttESCROW_CANCEL, 4, EscrowCancel, /** This transaction type sets or clears an account's "regular key". */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, Delegation::notDelegable, @@ -121,7 +121,7 @@ TRANSACTION(ttREGULAR_KEY_SET, 5, SetRegularKey, /** This transaction type creates an offer to trade one asset for another. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, Delegation::delegable, @@ -137,7 +137,7 @@ TRANSACTION(ttOFFER_CREATE, 7, OfferCreate, /** This transaction type cancels existing offers to trade one asset for another. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, Delegation::delegable, @@ -151,7 +151,7 @@ TRANSACTION(ttOFFER_CANCEL, 8, OfferCancel, /** This transaction type creates a new set of tickets. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, Delegation::delegable, @@ -167,7 +167,7 @@ TRANSACTION(ttTICKET_CREATE, 10, TicketCreate, // The SignerEntries are optional because a SignerList is deleted by // setting the SignerQuorum to zero and omitting SignerEntries. #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, Delegation::notDelegable, @@ -180,7 +180,7 @@ TRANSACTION(ttSIGNER_LIST_SET, 12, SignerListSet, /** This transaction type creates a new unidirectional XRP payment channel. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPAYCHAN_CREATE, 13, PaymentChannelCreate, Delegation::delegable, @@ -222,7 +222,7 @@ TRANSACTION(ttPAYCHAN_CLAIM, 15, PaymentChannelClaim, /** This transaction type creates a new check. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, Delegation::delegable, @@ -238,7 +238,7 @@ TRANSACTION(ttCHECK_CREATE, 16, CheckCreate, /** This transaction type cashes an existing check. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCHECK_CASH, 17, CheckCash, Delegation::delegable, @@ -252,7 +252,7 @@ TRANSACTION(ttCHECK_CASH, 17, CheckCash, /** This transaction type cancels an existing check. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, Delegation::delegable, @@ -264,7 +264,7 @@ TRANSACTION(ttCHECK_CANCEL, 18, CheckCancel, /** This transaction type grants or revokes authorization to transfer funds. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, Delegation::delegable, @@ -279,7 +279,7 @@ TRANSACTION(ttDEPOSIT_PREAUTH, 19, DepositPreauth, /** This transaction type modifies a trustline between two accounts. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttTRUST_SET, 20, TrustSet, Delegation::delegable, @@ -293,7 +293,7 @@ TRANSACTION(ttTRUST_SET, 20, TrustSet, /** This transaction type deletes an existing account. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, Delegation::notDelegable, @@ -309,7 +309,7 @@ TRANSACTION(ttACCOUNT_DELETE, 21, AccountDelete, /** This transaction mints a new NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, Delegation::delegable, @@ -327,7 +327,7 @@ TRANSACTION(ttNFTOKEN_MINT, 25, NFTokenMint, /** This transaction burns (i.e. destroys) an existing NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, Delegation::delegable, @@ -340,7 +340,7 @@ TRANSACTION(ttNFTOKEN_BURN, 26, NFTokenBurn, /** This transaction creates a new offer to buy or sell an NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, Delegation::delegable, @@ -356,7 +356,7 @@ TRANSACTION(ttNFTOKEN_CREATE_OFFER, 27, NFTokenCreateOffer, /** This transaction cancels an existing offer to buy or sell an existing NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, Delegation::delegable, @@ -368,7 +368,7 @@ TRANSACTION(ttNFTOKEN_CANCEL_OFFER, 28, NFTokenCancelOffer, /** This transaction accepts an existing offer to buy or sell an existing NFT. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, Delegation::delegable, @@ -382,7 +382,7 @@ TRANSACTION(ttNFTOKEN_ACCEPT_OFFER, 29, NFTokenAcceptOffer, /** This transaction claws back issued tokens. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCLAWBACK, 30, Clawback, Delegation::delegable, @@ -395,7 +395,7 @@ TRANSACTION(ttCLAWBACK, 30, Clawback, /** This transaction claws back tokens from an AMM pool. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, Delegation::delegable, @@ -410,7 +410,7 @@ TRANSACTION(ttAMM_CLAWBACK, 31, AMMClawback, /** This transaction type creates an AMM instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_CREATE, 35, AMMCreate, Delegation::delegable, @@ -424,7 +424,7 @@ TRANSACTION(ttAMM_CREATE, 35, AMMCreate, /** This transaction type deposits into an AMM instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, Delegation::delegable, @@ -442,7 +442,7 @@ TRANSACTION(ttAMM_DEPOSIT, 36, AMMDeposit, /** This transaction type withdraws from an AMM instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, Delegation::delegable, @@ -459,7 +459,7 @@ TRANSACTION(ttAMM_WITHDRAW, 37, AMMWithdraw, /** This transaction type votes for the trading fee */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_VOTE, 38, AMMVote, Delegation::delegable, @@ -473,7 +473,7 @@ TRANSACTION(ttAMM_VOTE, 38, AMMVote, /** This transaction type bids for the auction slot */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_BID, 39, AMMBid, Delegation::delegable, @@ -489,7 +489,7 @@ TRANSACTION(ttAMM_BID, 39, AMMBid, /** This transaction type deletes AMM in the empty state */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMM_DELETE, 40, AMMDelete, Delegation::delegable, @@ -502,7 +502,7 @@ TRANSACTION(ttAMM_DELETE, 40, AMMDelete, /** This transactions creates a crosschain sequence number */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttXCHAIN_CREATE_CLAIM_ID, 41, XChainCreateClaimID, Delegation::delegable, @@ -617,7 +617,7 @@ TRANSACTION(ttXCHAIN_CREATE_BRIDGE, 48, XChainCreateBridge, /** This transaction type creates or updates a DID */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttDID_SET, 49, DIDSet, Delegation::delegable, @@ -638,7 +638,7 @@ TRANSACTION(ttDID_DELETE, 50, DIDDelete, /** This transaction type creates an Oracle instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttORACLE_SET, 51, OracleSet, Delegation::delegable, @@ -655,7 +655,7 @@ TRANSACTION(ttORACLE_SET, 51, OracleSet, /** This transaction type deletes an Oracle instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, Delegation::delegable, @@ -667,7 +667,7 @@ TRANSACTION(ttORACLE_DELETE, 52, OracleDelete, /** This transaction type fixes a problem in the ledger state */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, Delegation::delegable, @@ -680,7 +680,7 @@ TRANSACTION(ttLEDGER_STATE_FIX, 53, LedgerStateFix, /** This transaction type creates a MPTokensIssuance instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, Delegation::delegable, @@ -697,7 +697,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_CREATE, 54, MPTokenIssuanceCreate, /** This transaction type destroys a MPTokensIssuance instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, Delegation::delegable, @@ -709,7 +709,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_DESTROY, 55, MPTokenIssuanceDestroy, /** This transaction type sets flags on a MPTokensIssuance or MPToken instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, Delegation::delegable, @@ -726,7 +726,7 @@ TRANSACTION(ttMPTOKEN_ISSUANCE_SET, 56, MPTokenIssuanceSet, /** This transaction type authorizes a MPToken instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, Delegation::delegable, @@ -739,7 +739,7 @@ TRANSACTION(ttMPTOKEN_AUTHORIZE, 57, MPTokenAuthorize, /** This transaction type create an Credential instance */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttCREDENTIAL_CREATE, 58, CredentialCreate, Delegation::delegable, @@ -775,7 +775,7 @@ TRANSACTION(ttCREDENTIAL_DELETE, 60, CredentialDelete, /** This transaction type modify a NFToken */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, Delegation::delegable, @@ -789,7 +789,7 @@ TRANSACTION(ttNFTOKEN_MODIFY, 61, NFTokenModify, /** This transaction type creates or modifies a Permissioned Domain */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, Delegation::delegable, @@ -802,7 +802,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_SET, 62, PermissionedDomainSet, /** This transaction type deletes a Permissioned Domain */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, Delegation::delegable, @@ -814,7 +814,7 @@ TRANSACTION(ttPERMISSIONED_DOMAIN_DELETE, 63, PermissionedDomainDelete, /** This transaction type delegates authorized account specified permissions */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, Delegation::notDelegable, @@ -827,7 +827,7 @@ TRANSACTION(ttDELEGATE_SET, 64, DelegateSet, /** This transaction creates a single asset vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, Delegation::delegable, @@ -845,7 +845,7 @@ TRANSACTION(ttVAULT_CREATE, 65, VaultCreate, /** This transaction updates a single asset vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_SET, 66, VaultSet, Delegation::delegable, @@ -860,7 +860,7 @@ TRANSACTION(ttVAULT_SET, 66, VaultSet, /** This transaction deletes a single asset vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, Delegation::delegable, @@ -872,7 +872,7 @@ TRANSACTION(ttVAULT_DELETE, 67, VaultDelete, /** This transaction trades assets for shares with a vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, Delegation::delegable, @@ -885,7 +885,7 @@ TRANSACTION(ttVAULT_DEPOSIT, 68, VaultDeposit, /** This transaction trades shares for assets with a vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, Delegation::delegable, @@ -900,7 +900,7 @@ TRANSACTION(ttVAULT_WITHDRAW, 69, VaultWithdraw, /** This transaction claws back tokens from a vault. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, Delegation::delegable, @@ -914,7 +914,7 @@ TRANSACTION(ttVAULT_CLAWBACK, 70, VaultClawback, /** This transaction type batches together transactions. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttBATCH, 71, Batch, Delegation::notDelegable, @@ -929,7 +929,7 @@ TRANSACTION(ttBATCH, 71, Batch, /** This transaction creates and updates a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet, Delegation::delegable, @@ -946,7 +946,7 @@ TRANSACTION(ttLOAN_BROKER_SET, 74, LoanBrokerSet, /** This transaction deletes a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete, Delegation::delegable, @@ -957,7 +957,7 @@ TRANSACTION(ttLOAN_BROKER_DELETE, 75, LoanBrokerDelete, /** This transaction deposits First Loss Capital into a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit, Delegation::delegable, @@ -969,7 +969,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_DEPOSIT, 76, LoanBrokerCoverDeposit, /** This transaction withdraws First Loss Capital from a Loan Broker */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw, Delegation::delegable, @@ -984,7 +984,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_WITHDRAW, 77, LoanBrokerCoverWithdraw, /** This transaction claws back First Loss Capital from a Loan Broker to the issuer of the capital */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback, Delegation::delegable, @@ -996,7 +996,7 @@ TRANSACTION(ttLOAN_BROKER_COVER_CLAWBACK, 78, LoanBrokerCoverClawback, /** This transaction creates a Loan */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_SET, 80, LoanSet, Delegation::delegable, @@ -1023,7 +1023,7 @@ TRANSACTION(ttLOAN_SET, 80, LoanSet, /** This transaction deletes an existing Loan */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_DELETE, 81, LoanDelete, Delegation::delegable, @@ -1034,7 +1034,7 @@ TRANSACTION(ttLOAN_DELETE, 81, LoanDelete, /** This transaction is used to change the delinquency status of an existing Loan */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_MANAGE, 82, LoanManage, Delegation::delegable, @@ -1048,7 +1048,7 @@ TRANSACTION(ttLOAN_MANAGE, 82, LoanManage, /** The Borrower uses this transaction to make a Payment on the Loan. */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttLOAN_PAY, 84, LoanPay, Delegation::delegable, @@ -1063,7 +1063,7 @@ TRANSACTION(ttLOAN_PAY, 84, LoanPay, For details, see: https://xrpl.org/amendments.html */ #if TRANSACTION_INCLUDE -# include +# include #endif TRANSACTION(ttAMENDMENT, 100, EnableAmendment, Delegation::notDelegable, diff --git a/src/xrpld/app/misc/LoadFeeTrack.h b/include/xrpl/server/LoadFeeTrack.h similarity index 100% rename from src/xrpld/app/misc/LoadFeeTrack.h rename to include/xrpl/server/LoadFeeTrack.h diff --git a/include/xrpl/server/detail/BaseHTTPPeer.h b/include/xrpl/server/detail/BaseHTTPPeer.h index ab85cb7c89..78ad4cff4f 100644 --- a/include/xrpl/server/detail/BaseHTTPPeer.h +++ b/include/xrpl/server/detail/BaseHTTPPeer.h @@ -218,7 +218,7 @@ void BaseHTTPPeer::close() { if (!strand_.running_in_this_thread()) - return post(strand_, std::bind((void(BaseHTTPPeer::*)(void)) & BaseHTTPPeer::close, impl().shared_from_this())); + return post(strand_, std::bind((void (BaseHTTPPeer::*)(void))&BaseHTTPPeer::close, impl().shared_from_this())); boost::beast::get_lowest_layer(impl().stream_).close(); } @@ -436,7 +436,7 @@ BaseHTTPPeer::close(bool graceful) return post( strand_, std::bind( - (void(BaseHTTPPeer::*)(bool)) & BaseHTTPPeer::close, + (void (BaseHTTPPeer::*)(bool))&BaseHTTPPeer::close, impl().shared_from_this(), graceful)); diff --git a/include/xrpl/server/detail/BaseWSPeer.h b/include/xrpl/server/detail/BaseWSPeer.h index ab985dfac5..723e48d950 100644 --- a/include/xrpl/server/detail/BaseWSPeer.h +++ b/include/xrpl/server/detail/BaseWSPeer.h @@ -178,8 +178,9 @@ BaseWSPeer::run() impl().ws_.control_callback(control_callback_); start_timer(); close_on_timer_ = true; - impl().ws_.set_option(boost::beast::websocket::stream_base::decorator( - [](auto& res) { res.set(boost::beast::http::field::server, BuildInfo::getFullVersionString()); })); + impl().ws_.set_option(boost::beast::websocket::stream_base::decorator([](auto& res) { + res.set(boost::beast::http::field::server, BuildInfo::getFullVersionString()); + })); impl().ws_.async_accept( request_, bind_executor( diff --git a/src/xrpld/app/tx/detail/ApplyContext.h b/include/xrpl/tx/ApplyContext.h similarity index 85% rename from src/xrpld/app/tx/detail/ApplyContext.h rename to include/xrpl/tx/ApplyContext.h index 45345df265..9e382556c2 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.h +++ b/include/xrpl/tx/ApplyContext.h @@ -1,9 +1,7 @@ #pragma once -#include -#include - #include +#include #include #include #include @@ -17,7 +15,7 @@ class ApplyContext { public: explicit ApplyContext( - Application& app, + ServiceRegistry& registry, OpenView& base, std::optional const& parentBatchId, STTx const& tx, @@ -27,19 +25,19 @@ public: beast::Journal journal = beast::Journal{beast::Journal::getNullSink()}); explicit ApplyContext( - Application& app, + ServiceRegistry& registry, OpenView& base, STTx const& tx, TER preclaimResult, XRPAmount baseFee, ApplyFlags flags, beast::Journal journal = beast::Journal{beast::Journal::getNullSink()}) - : ApplyContext(app, base, std::nullopt, tx, preclaimResult, baseFee, flags, journal) + : ApplyContext(registry, base, std::nullopt, tx, preclaimResult, baseFee, flags, journal) { XRPL_ASSERT((flags & tapBATCH) == 0, "Batch apply flag should not be set"); } - Application& app; + ServiceRegistry& registry; STTx const& tx; TER const preclaimResult; XRPAmount const baseFee; @@ -90,11 +88,12 @@ public: /** Visit unapplied changes. */ void - visit(std::function const& before, - std::shared_ptr const& after)> const& func); + visit( + std::function const& before, + std::shared_ptr const& after)> const& func); void destroyXRP(XRPAmount const& fee) diff --git a/src/xrpld/app/tx/detail/InvariantCheck.h b/include/xrpl/tx/InvariantCheck.h similarity index 100% rename from src/xrpld/app/tx/detail/InvariantCheck.h rename to include/xrpl/tx/InvariantCheck.h diff --git a/src/xrpld/app/tx/detail/SignerEntries.h b/include/xrpl/tx/SignerEntries.h similarity index 97% rename from src/xrpld/app/tx/detail/SignerEntries.h rename to include/xrpl/tx/SignerEntries.h index fe01d6b1ee..1e9c5fcb53 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.h +++ b/include/xrpl/tx/SignerEntries.h @@ -1,11 +1,10 @@ #pragma once -#include // NotTEC - #include // #include // beast::Journal #include // temMALFORMED #include // AccountID +#include // NotTEC #include #include diff --git a/src/xrpld/app/tx/detail/Transactor.h b/include/xrpl/tx/Transactor.h similarity index 93% rename from src/xrpld/app/tx/detail/Transactor.h rename to include/xrpl/tx/Transactor.h index e06086a55d..b4f155f42d 100644 --- a/src/xrpld/app/tx/detail/Transactor.h +++ b/include/xrpl/tx/Transactor.h @@ -1,12 +1,11 @@ #pragma once -#include -#include - #include #include #include #include +#include +#include namespace xrpl { @@ -14,7 +13,7 @@ namespace xrpl { struct PreflightContext { public: - Application& app; + ServiceRegistry& registry; STTx const& tx; Rules const rules; ApplyFlags flags; @@ -22,24 +21,24 @@ public: beast::Journal const j; PreflightContext( - Application& app_, + ServiceRegistry& registry_, STTx const& tx_, uint256 parentBatchId_, Rules const& rules_, ApplyFlags flags_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : app(app_), tx(tx_), rules(rules_), flags(flags_), parentBatchId(parentBatchId_), j(j_) + : registry(registry_), tx(tx_), rules(rules_), flags(flags_), parentBatchId(parentBatchId_), j(j_) { XRPL_ASSERT((flags_ & tapBATCH) == tapBATCH, "Batch apply flag should be set"); } PreflightContext( - Application& app_, + ServiceRegistry& registry_, STTx const& tx_, Rules const& rules_, ApplyFlags flags_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : app(app_), tx(tx_), rules(rules_), flags(flags_), j(j_) + : registry(registry_), tx(tx_), rules(rules_), flags(flags_), j(j_) { XRPL_ASSERT((flags_ & tapBATCH) == 0, "Batch apply flag should not be set"); } @@ -52,7 +51,7 @@ public: struct PreclaimContext { public: - Application& app; + ServiceRegistry& registry; ReadView const& view; TER preflightResult; ApplyFlags flags; @@ -61,14 +60,14 @@ public: beast::Journal const j; PreclaimContext( - Application& app_, + ServiceRegistry& registry_, ReadView const& view_, TER preflightResult_, STTx const& tx_, ApplyFlags flags_, std::optional parentBatchId_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : app(app_) + : registry(registry_) , view(view_) , preflightResult(preflightResult_) , flags(flags_) @@ -82,13 +81,13 @@ public: } PreclaimContext( - Application& app_, + ServiceRegistry& registry_, ReadView const& view_, TER preflightResult_, STTx const& tx_, ApplyFlags flags_, beast::Journal j_ = beast::Journal{beast::Journal::getNullSink()}) - : PreclaimContext(app_, view_, preflightResult_, tx_, flags_, std::nullopt, j_) + : PreclaimContext(registry_, view_, preflightResult_, tx_, flags_, std::nullopt, j_) { XRPL_ASSERT((flags_ & tapBATCH) == 0, "Batch apply flag should not be set"); } @@ -225,14 +224,14 @@ protected: /** Compute the minimum fee required to process a transaction with a given baseFee based on the current server load. - @param app The application hosting the server + @param registry The service registry. @param baseFee The base fee of a candidate transaction @see xrpl::calculateBaseFee @param fees Fee settings from the current ledger @param flags Transaction processing fees */ static XRPAmount - minimumFee(Application& app, XRPAmount baseFee, Fees const& fees, ApplyFlags flags); + minimumFee(ServiceRegistry& registry, XRPAmount baseFee, Fees const& fees, ApplyFlags flags); // Returns the fee in fee units, not scaled for load. static XRPAmount diff --git a/src/xrpld/app/tx/apply.h b/include/xrpl/tx/apply.h similarity index 93% rename from src/xrpld/app/tx/apply.h rename to include/xrpl/tx/apply.h index c3ff4f905e..dbba0807f0 100644 --- a/src/xrpld/app/tx/apply.h +++ b/include/xrpl/tx/apply.h @@ -1,18 +1,16 @@ #pragma once -#include -#include - #include #include #include +#include #include namespace xrpl { -class Application; class HashRouter; +class ServiceRegistry; /** Describes the pre-processing validity of a transaction. @@ -41,7 +39,7 @@ enum class Validity { @see Validity */ std::pair -checkValidity(HashRouter& router, STTx const& tx, Rules const& rules, Config const& config); +checkValidity(HashRouter& router, STTx const& tx, Rules const& rules); /** Sets the validity of a given transaction in the cache. @@ -97,7 +95,7 @@ forceValidity(HashRouter& router, uint256 const& txid, Validity validity); whether or not the transaction was applied. */ ApplyResult -apply(Application& app, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal journal); +apply(ServiceRegistry& registry, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal journal); /** Enum class for return value from `applyTransaction` @@ -121,7 +119,7 @@ enum class ApplyTransactionResult { */ ApplyTransactionResult applyTransaction( - Application& app, + ServiceRegistry& registry, OpenView& view, STTx const& tx, bool retryAssured, diff --git a/src/xrpld/app/tx/applySteps.h b/include/xrpl/tx/applySteps.h similarity index 95% rename from src/xrpld/app/tx/applySteps.h rename to include/xrpl/tx/applySteps.h index ef87d352f3..7699ed2493 100644 --- a/src/xrpld/app/tx/applySteps.h +++ b/include/xrpl/tx/applySteps.h @@ -5,7 +5,7 @@ namespace xrpl { -class Application; +class ServiceRegistry; class STTx; class TxQ; @@ -240,11 +240,11 @@ public: */ /** @{ */ PreflightResult -preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j); +preflight(ServiceRegistry& registry, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j); PreflightResult preflight( - Application& app, + ServiceRegistry& registry, Rules const& rules, uint256 const& parentBatchId, STTx const& tx, @@ -281,7 +281,7 @@ preflight( this transaction. */ PreclaimResult -preclaim(PreflightResult const& preflightResult, Application& app, OpenView const& view); +preclaim(PreflightResult const& preflightResult, ServiceRegistry& registry, OpenView const& view); /** Compute only the expected base fee for a transaction. @@ -323,7 +323,7 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx); @param preclaimResult The result of a previous call to `preclaim` for the transaction. - @param app The current running `Application`. + @param registry The service registry. @param view The open ledger that the transaction will attempt to be applied to. @@ -333,6 +333,6 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx); whether or not the transaction was applied. */ ApplyResult -doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view); +doApply(PreclaimResult const& preclaimResult, ServiceRegistry& registry, OpenView& view); } // namespace xrpl diff --git a/src/xrpld/app/tx/detail/BookTip.h b/include/xrpl/tx/paths/BookTip.h similarity index 100% rename from src/xrpld/app/tx/detail/BookTip.h rename to include/xrpl/tx/paths/BookTip.h diff --git a/src/xrpld/app/paths/Flow.h b/include/xrpl/tx/paths/Flow.h similarity index 95% rename from src/xrpld/app/paths/Flow.h rename to include/xrpl/tx/paths/Flow.h index 1a46ce221a..32e8c3611b 100644 --- a/src/xrpld/app/paths/Flow.h +++ b/include/xrpl/tx/paths/Flow.h @@ -1,9 +1,8 @@ #pragma once -#include -#include - #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Offer.h b/include/xrpl/tx/paths/Offer.h similarity index 100% rename from src/xrpld/app/tx/detail/Offer.h rename to include/xrpl/tx/paths/Offer.h diff --git a/src/xrpld/app/tx/detail/OfferStream.h b/include/xrpl/tx/paths/OfferStream.h similarity index 98% rename from src/xrpld/app/tx/detail/OfferStream.h rename to include/xrpl/tx/paths/OfferStream.h index 2f6bda3fab..df96a1b6da 100644 --- a/src/xrpld/app/tx/detail/OfferStream.h +++ b/include/xrpl/tx/paths/OfferStream.h @@ -1,12 +1,11 @@ #pragma once -#include -#include - #include #include #include #include +#include +#include #include diff --git a/src/xrpld/app/paths/RippleCalc.h b/include/xrpl/tx/paths/RippleCalc.h similarity index 100% rename from src/xrpld/app/paths/RippleCalc.h rename to include/xrpl/tx/paths/RippleCalc.h diff --git a/src/xrpld/app/paths/detail/AmountSpec.h b/include/xrpl/tx/paths/detail/AmountSpec.h similarity index 100% rename from src/xrpld/app/paths/detail/AmountSpec.h rename to include/xrpl/tx/paths/detail/AmountSpec.h diff --git a/src/xrpld/app/paths/detail/FlatSets.h b/include/xrpl/tx/paths/detail/FlatSets.h similarity index 100% rename from src/xrpld/app/paths/detail/FlatSets.h rename to include/xrpl/tx/paths/detail/FlatSets.h diff --git a/src/xrpld/app/paths/detail/FlowDebugInfo.h b/include/xrpl/tx/paths/detail/FlowDebugInfo.h similarity index 99% rename from src/xrpld/app/paths/detail/FlowDebugInfo.h rename to include/xrpl/tx/paths/detail/FlowDebugInfo.h index d7b97a49d4..dc0ba17d4e 100644 --- a/src/xrpld/app/paths/detail/FlowDebugInfo.h +++ b/include/xrpl/tx/paths/detail/FlowDebugInfo.h @@ -1,10 +1,9 @@ #pragma once -#include - #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/Steps.h b/include/xrpl/tx/paths/detail/Steps.h similarity index 99% rename from src/xrpld/app/paths/detail/Steps.h rename to include/xrpl/tx/paths/detail/Steps.h index 580b8c487e..762d5ebe5d 100644 --- a/src/xrpld/app/paths/detail/Steps.h +++ b/include/xrpl/tx/paths/detail/Steps.h @@ -1,13 +1,12 @@ #pragma once -#include - #include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/StrandFlow.h b/include/xrpl/tx/paths/detail/StrandFlow.h similarity index 98% rename from src/xrpld/app/paths/detail/StrandFlow.h rename to include/xrpl/tx/paths/detail/StrandFlow.h index aa3d00a822..01d77b73f0 100644 --- a/src/xrpld/app/paths/detail/StrandFlow.h +++ b/include/xrpl/tx/paths/detail/StrandFlow.h @@ -1,18 +1,17 @@ #pragma once -#include -#include -#include -#include -#include -#include -#include - #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/AMMBid.h b/include/xrpl/tx/transactors/AMM/AMMBid.h similarity index 98% rename from src/xrpld/app/tx/detail/AMMBid.h rename to include/xrpl/tx/transactors/AMM/AMMBid.h index 83ea6e0729..b80bfe3bef 100644 --- a/src/xrpld/app/tx/detail/AMMBid.h +++ b/include/xrpl/tx/transactors/AMM/AMMBid.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMClawback.h b/include/xrpl/tx/transactors/AMM/AMMClawback.h similarity index 97% rename from src/xrpld/app/tx/detail/AMMClawback.h rename to include/xrpl/tx/transactors/AMM/AMMClawback.h index 3da3c44605..2bfccfa202 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.h +++ b/include/xrpl/tx/transactors/AMM/AMMClawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { class Sandbox; diff --git a/src/xrpld/app/paths/AMMContext.h b/include/xrpl/tx/transactors/AMM/AMMContext.h similarity index 100% rename from src/xrpld/app/paths/AMMContext.h rename to include/xrpl/tx/transactors/AMM/AMMContext.h diff --git a/src/xrpld/app/tx/detail/AMMCreate.h b/include/xrpl/tx/transactors/AMM/AMMCreate.h similarity index 98% rename from src/xrpld/app/tx/detail/AMMCreate.h rename to include/xrpl/tx/transactors/AMM/AMMCreate.h index 6f9fd77a2f..5deaa129ed 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.h +++ b/include/xrpl/tx/transactors/AMM/AMMCreate.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDelete.h b/include/xrpl/tx/transactors/AMM/AMMDelete.h similarity index 94% rename from src/xrpld/app/tx/detail/AMMDelete.h rename to include/xrpl/tx/transactors/AMM/AMMDelete.h index 20c8f87262..1c0996f8a2 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.h +++ b/include/xrpl/tx/transactors/AMM/AMMDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDeposit.h b/include/xrpl/tx/transactors/AMM/AMMDeposit.h similarity index 99% rename from src/xrpld/app/tx/detail/AMMDeposit.h rename to include/xrpl/tx/transactors/AMM/AMMDeposit.h index 45c7995438..287d46ff07 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.h +++ b/include/xrpl/tx/transactors/AMM/AMMDeposit.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/AMMHelpers.h b/include/xrpl/tx/transactors/AMM/AMMHelpers.h similarity index 100% rename from src/xrpld/app/misc/AMMHelpers.h rename to include/xrpl/tx/transactors/AMM/AMMHelpers.h diff --git a/src/xrpld/app/misc/AMMUtils.h b/include/xrpl/tx/transactors/AMM/AMMUtils.h similarity index 100% rename from src/xrpld/app/misc/AMMUtils.h rename to include/xrpl/tx/transactors/AMM/AMMUtils.h diff --git a/src/xrpld/app/tx/detail/AMMVote.h b/include/xrpl/tx/transactors/AMM/AMMVote.h similarity index 97% rename from src/xrpld/app/tx/detail/AMMVote.h rename to include/xrpl/tx/transactors/AMM/AMMVote.h index 2bc3da2301..ab04b30993 100644 --- a/src/xrpld/app/tx/detail/AMMVote.h +++ b/include/xrpl/tx/transactors/AMM/AMMVote.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.h b/include/xrpl/tx/transactors/AMM/AMMWithdraw.h similarity index 99% rename from src/xrpld/app/tx/detail/AMMWithdraw.h rename to include/xrpl/tx/transactors/AMM/AMMWithdraw.h index 246c66100c..c15bb68644 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.h +++ b/include/xrpl/tx/transactors/AMM/AMMWithdraw.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Batch.h b/include/xrpl/tx/transactors/Batch.h similarity index 96% rename from src/xrpld/app/tx/detail/Batch.h rename to include/xrpl/tx/transactors/Batch.h index 17abec38c3..0861deb094 100644 --- a/src/xrpld/app/tx/detail/Batch.h +++ b/include/xrpl/tx/transactors/Batch.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Change.h b/include/xrpl/tx/transactors/Change.h similarity index 93% rename from src/xrpld/app/tx/detail/Change.h rename to include/xrpl/tx/transactors/Change.h index 683b054ccb..1bf63ff0db 100644 --- a/src/xrpld/app/tx/detail/Change.h +++ b/include/xrpl/tx/transactors/Change.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CancelCheck.h b/include/xrpl/tx/transactors/Check/CancelCheck.h similarity index 90% rename from src/xrpld/app/tx/detail/CancelCheck.h rename to include/xrpl/tx/transactors/Check/CancelCheck.h index f125b9af5b..8a0e42c7ca 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.h +++ b/include/xrpl/tx/transactors/Check/CancelCheck.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CashCheck.h b/include/xrpl/tx/transactors/Check/CashCheck.h similarity index 90% rename from src/xrpld/app/tx/detail/CashCheck.h rename to include/xrpl/tx/transactors/Check/CashCheck.h index 50a4f8a63a..138790cf34 100644 --- a/src/xrpld/app/tx/detail/CashCheck.h +++ b/include/xrpl/tx/transactors/Check/CashCheck.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateCheck.h b/include/xrpl/tx/transactors/Check/CreateCheck.h similarity index 90% rename from src/xrpld/app/tx/detail/CreateCheck.h rename to include/xrpl/tx/transactors/Check/CreateCheck.h index b80536fe02..98950b68f2 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.h +++ b/include/xrpl/tx/transactors/Check/CreateCheck.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Clawback.h b/include/xrpl/tx/transactors/Clawback.h similarity index 91% rename from src/xrpld/app/tx/detail/Clawback.h rename to include/xrpl/tx/transactors/Clawback.h index 427edb25b4..7451266461 100644 --- a/src/xrpld/app/tx/detail/Clawback.h +++ b/include/xrpl/tx/transactors/Clawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateTicket.h b/include/xrpl/tx/transactors/CreateTicket.h similarity index 98% rename from src/xrpld/app/tx/detail/CreateTicket.h rename to include/xrpl/tx/transactors/CreateTicket.h index dd424e3756..867ad99c12 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.h +++ b/include/xrpl/tx/transactors/CreateTicket.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Credentials.h b/include/xrpl/tx/transactors/Credentials.h similarity index 97% rename from src/xrpld/app/tx/detail/Credentials.h rename to include/xrpl/tx/transactors/Credentials.h index 02bccde198..8c96f40526 100644 --- a/src/xrpld/app/tx/detail/Credentials.h +++ b/include/xrpl/tx/transactors/Credentials.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DID.h b/include/xrpl/tx/transactors/DID.h similarity index 95% rename from src/xrpld/app/tx/detail/DID.h rename to include/xrpl/tx/transactors/DID.h index a00039a999..8ab80bc694 100644 --- a/src/xrpld/app/tx/detail/DID.h +++ b/include/xrpl/tx/transactors/DID.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DelegateSet.h b/include/xrpl/tx/transactors/Delegate/DelegateSet.h similarity index 92% rename from src/xrpld/app/tx/detail/DelegateSet.h rename to include/xrpl/tx/transactors/Delegate/DelegateSet.h index 2120674557..d5ea0f13cc 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.h +++ b/include/xrpl/tx/transactors/Delegate/DelegateSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/DelegateUtils.h b/include/xrpl/tx/transactors/Delegate/DelegateUtils.h similarity index 100% rename from src/xrpld/app/misc/DelegateUtils.h rename to include/xrpl/tx/transactors/Delegate/DelegateUtils.h diff --git a/src/xrpld/app/tx/detail/DeleteAccount.h b/include/xrpl/tx/transactors/DeleteAccount.h similarity index 93% rename from src/xrpld/app/tx/detail/DeleteAccount.h rename to include/xrpl/tx/transactors/DeleteAccount.h index 742d1f4257..f55888ee00 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.h +++ b/include/xrpl/tx/transactors/DeleteAccount.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DeleteOracle.h b/include/xrpl/tx/transactors/DeleteOracle.h similarity index 95% rename from src/xrpld/app/tx/detail/DeleteOracle.h rename to include/xrpl/tx/transactors/DeleteOracle.h index 7d7cc340cb..7140a9096a 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.h +++ b/include/xrpl/tx/transactors/DeleteOracle.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DepositPreauth.h b/include/xrpl/tx/transactors/DepositPreauth.h similarity index 93% rename from src/xrpld/app/tx/detail/DepositPreauth.h rename to include/xrpl/tx/transactors/DepositPreauth.h index f1afac3b18..24050da600 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.h +++ b/include/xrpl/tx/transactors/DepositPreauth.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Escrow.h b/include/xrpl/tx/transactors/Escrow.h similarity index 97% rename from src/xrpld/app/tx/detail/Escrow.h rename to include/xrpl/tx/transactors/Escrow.h index cb99dcae06..0fd627e5a9 100644 --- a/src/xrpld/app/tx/detail/Escrow.h +++ b/include/xrpl/tx/transactors/Escrow.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.h b/include/xrpl/tx/transactors/LedgerStateFix.h similarity index 92% rename from src/xrpld/app/tx/detail/LedgerStateFix.h rename to include/xrpl/tx/transactors/LedgerStateFix.h index 66fe124cff..728f8c651d 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.h +++ b/include/xrpl/tx/transactors/LedgerStateFix.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/LendingHelpers.h b/include/xrpl/tx/transactors/Lending/LendingHelpers.h similarity index 100% rename from src/xrpld/app/misc/LendingHelpers.h rename to include/xrpl/tx/transactors/Lending/LendingHelpers.h diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h index 139d50696a..b1e539392f 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverClawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h similarity index 92% rename from src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h index 3f683c6a62..8dda417443 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h index 50d0b98fa5..52b14bfb67 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.h b/include/xrpl/tx/transactors/Lending/LoanBrokerDelete.h similarity index 92% rename from src/xrpld/app/tx/detail/LoanBrokerDelete.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerDelete.h index cb44277f55..b9c9851c41 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.h b/include/xrpl/tx/transactors/Lending/LoanBrokerSet.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanBrokerSet.h rename to include/xrpl/tx/transactors/Lending/LoanBrokerSet.h index cda452bebe..ce1e069791 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.h +++ b/include/xrpl/tx/transactors/Lending/LoanBrokerSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanDelete.h b/include/xrpl/tx/transactors/Lending/LoanDelete.h similarity index 92% rename from src/xrpld/app/tx/detail/LoanDelete.h rename to include/xrpl/tx/transactors/Lending/LoanDelete.h index 37889d31fb..ff78d7db60 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.h +++ b/include/xrpl/tx/transactors/Lending/LoanDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanManage.h b/include/xrpl/tx/transactors/Lending/LoanManage.h similarity index 96% rename from src/xrpld/app/tx/detail/LoanManage.h rename to include/xrpl/tx/transactors/Lending/LoanManage.h index 44b2b62b3d..26ed041ac7 100644 --- a/src/xrpld/app/tx/detail/LoanManage.h +++ b/include/xrpl/tx/transactors/Lending/LoanManage.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanPay.h b/include/xrpl/tx/transactors/Lending/LoanPay.h similarity index 94% rename from src/xrpld/app/tx/detail/LoanPay.h rename to include/xrpl/tx/transactors/Lending/LoanPay.h index c947b1b6f8..2e3cce75ed 100644 --- a/src/xrpld/app/tx/detail/LoanPay.h +++ b/include/xrpl/tx/transactors/Lending/LoanPay.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanSet.h b/include/xrpl/tx/transactors/Lending/LoanSet.h similarity index 93% rename from src/xrpld/app/tx/detail/LoanSet.h rename to include/xrpl/tx/transactors/Lending/LoanSet.h index e4bb79a36d..e9916b9d6b 100644 --- a/src/xrpld/app/tx/detail/LoanSet.h +++ b/include/xrpl/tx/transactors/Lending/LoanSet.h @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.h b/include/xrpl/tx/transactors/MPT/MPTokenAuthorize.h similarity index 94% rename from src/xrpld/app/tx/detail/MPTokenAuthorize.h rename to include/xrpl/tx/transactors/MPT/MPTokenAuthorize.h index c887b70fa8..1f53dfc42d 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenAuthorize.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h similarity index 96% rename from src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h rename to include/xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h index 56c20ed551..0ebde22a37 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceCreate.h @@ -1,9 +1,8 @@ #pragma once -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h similarity index 91% rename from src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h rename to include/xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h index 89243944d0..c4a448032a 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h similarity index 93% rename from src/xrpld/app/tx/detail/MPTokenIssuanceSet.h rename to include/xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h index 68794ca48c..dccd4e4cee 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.h +++ b/include/xrpl/tx/transactors/MPT/MPTokenIssuanceSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h b/include/xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h similarity index 95% rename from src/xrpld/app/tx/detail/NFTokenAcceptOffer.h rename to include/xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h index 549c38d33b..d876a70362 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenAcceptOffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.h b/include/xrpl/tx/transactors/NFT/NFTokenBurn.h similarity index 90% rename from src/xrpld/app/tx/detail/NFTokenBurn.h rename to include/xrpl/tx/transactors/NFT/NFTokenBurn.h index c2bc300ab8..8737997f03 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenBurn.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h b/include/xrpl/tx/transactors/NFT/NFTokenCancelOffer.h similarity index 91% rename from src/xrpld/app/tx/detail/NFTokenCancelOffer.h rename to include/xrpl/tx/transactors/NFT/NFTokenCancelOffer.h index b1801ede25..bb8cd4c216 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenCancelOffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h b/include/xrpl/tx/transactors/NFT/NFTokenCreateOffer.h similarity index 91% rename from src/xrpld/app/tx/detail/NFTokenCreateOffer.h rename to include/xrpl/tx/transactors/NFT/NFTokenCreateOffer.h index ed54338f49..a48e53589d 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenCreateOffer.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenMint.h b/include/xrpl/tx/transactors/NFT/NFTokenMint.h similarity index 89% rename from src/xrpld/app/tx/detail/NFTokenMint.h rename to include/xrpl/tx/transactors/NFT/NFTokenMint.h index 52981ef467..c3a7db4581 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenMint.h @@ -1,9 +1,8 @@ #pragma once -#include -#include - #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenModify.h b/include/xrpl/tx/transactors/NFT/NFTokenModify.h similarity index 90% rename from src/xrpld/app/tx/detail/NFTokenModify.h rename to include/xrpl/tx/transactors/NFT/NFTokenModify.h index f755746f1f..a64df65783 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenModify.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.h b/include/xrpl/tx/transactors/NFT/NFTokenUtils.h similarity index 98% rename from src/xrpld/app/tx/detail/NFTokenUtils.h rename to include/xrpl/tx/transactors/NFT/NFTokenUtils.h index 44d3cfb956..4e4150a369 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.h +++ b/include/xrpl/tx/transactors/NFT/NFTokenUtils.h @@ -1,12 +1,11 @@ #pragma once -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CancelOffer.h b/include/xrpl/tx/transactors/Offer/CancelOffer.h similarity index 91% rename from src/xrpld/app/tx/detail/CancelOffer.h rename to include/xrpl/tx/transactors/Offer/CancelOffer.h index 30a7129fb4..6107c3211f 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.h +++ b/include/xrpl/tx/transactors/Offer/CancelOffer.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateOffer.h b/include/xrpl/tx/transactors/Offer/CreateOffer.h similarity index 97% rename from src/xrpld/app/tx/detail/CreateOffer.h rename to include/xrpl/tx/transactors/Offer/CreateOffer.h index 14f82c501e..cb15d08ace 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.h +++ b/include/xrpl/tx/transactors/Offer/CreateOffer.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/PayChan.h b/include/xrpl/tx/transactors/PayChan.h similarity index 97% rename from src/xrpld/app/tx/detail/PayChan.h rename to include/xrpl/tx/transactors/PayChan.h index 8748ec9383..cc23f029f2 100644 --- a/src/xrpld/app/tx/detail/PayChan.h +++ b/include/xrpl/tx/transactors/PayChan.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Payment.h b/include/xrpl/tx/transactors/Payment.h similarity index 95% rename from src/xrpld/app/tx/detail/Payment.h rename to include/xrpl/tx/transactors/Payment.h index 192f2b0edb..bc5bc4fee3 100644 --- a/src/xrpld/app/tx/detail/Payment.h +++ b/include/xrpl/tx/transactors/Payment.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.h b/include/xrpl/tx/transactors/PermissionedDEXHelpers.h similarity index 100% rename from src/xrpld/app/misc/PermissionedDEXHelpers.h rename to include/xrpl/tx/transactors/PermissionedDEXHelpers.h diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h similarity index 91% rename from src/xrpld/app/tx/detail/PermissionedDomainDelete.h rename to include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h index 294fb794ae..b5c72413a2 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.h +++ b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.h b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h similarity index 92% rename from src/xrpld/app/tx/detail/PermissionedDomainSet.h rename to include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h index 824104e50d..acf9194ee2 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.h +++ b/include/xrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetAccount.h b/include/xrpl/tx/transactors/SetAccount.h similarity index 94% rename from src/xrpld/app/tx/detail/SetAccount.h rename to include/xrpl/tx/transactors/SetAccount.h index db59826347..3abfcb43bb 100644 --- a/src/xrpld/app/tx/detail/SetAccount.h +++ b/include/xrpl/tx/transactors/SetAccount.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetOracle.h b/include/xrpl/tx/transactors/SetOracle.h similarity index 94% rename from src/xrpld/app/tx/detail/SetOracle.h rename to include/xrpl/tx/transactors/SetOracle.h index 6b47a5397e..be1a7b8821 100644 --- a/src/xrpld/app/tx/detail/SetOracle.h +++ b/include/xrpl/tx/transactors/SetOracle.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetRegularKey.h b/include/xrpl/tx/transactors/SetRegularKey.h similarity index 90% rename from src/xrpld/app/tx/detail/SetRegularKey.h rename to include/xrpl/tx/transactors/SetRegularKey.h index bc712b319a..bb1dd48a68 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.h +++ b/include/xrpl/tx/transactors/SetRegularKey.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetSignerList.h b/include/xrpl/tx/transactors/SetSignerList.h similarity index 89% rename from src/xrpld/app/tx/detail/SetSignerList.h rename to include/xrpl/tx/transactors/SetSignerList.h index efd8e508f9..f0c6c276e9 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.h +++ b/include/xrpl/tx/transactors/SetSignerList.h @@ -1,10 +1,9 @@ #pragma once -#include -#include - #include #include +#include +#include #include #include @@ -44,7 +43,7 @@ public: // Interface used by DeleteAccount static TER - removeFromLedger(Application& app, ApplyView& view, AccountID const& account, beast::Journal j); + removeFromLedger(ServiceRegistry& registry, ApplyView& view, AccountID const& account, beast::Journal j); private: static std::tuple, Operation> diff --git a/src/xrpld/app/tx/detail/SetTrust.h b/include/xrpl/tx/transactors/SetTrust.h similarity index 93% rename from src/xrpld/app/tx/detail/SetTrust.h rename to include/xrpl/tx/transactors/SetTrust.h index 1081567a66..47ec26b6ad 100644 --- a/src/xrpld/app/tx/detail/SetTrust.h +++ b/include/xrpl/tx/transactors/SetTrust.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultClawback.h b/include/xrpl/tx/transactors/Vault/VaultClawback.h similarity index 93% rename from src/xrpld/app/tx/detail/VaultClawback.h rename to include/xrpl/tx/transactors/Vault/VaultClawback.h index c93289e641..131a1d87e7 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.h +++ b/include/xrpl/tx/transactors/Vault/VaultClawback.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultCreate.h b/include/xrpl/tx/transactors/Vault/VaultCreate.h similarity index 92% rename from src/xrpld/app/tx/detail/VaultCreate.h rename to include/xrpl/tx/transactors/Vault/VaultCreate.h index 20b18f5cc2..cc35cd765b 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.h +++ b/include/xrpl/tx/transactors/Vault/VaultCreate.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDelete.h b/include/xrpl/tx/transactors/Vault/VaultDelete.h similarity index 90% rename from src/xrpld/app/tx/detail/VaultDelete.h rename to include/xrpl/tx/transactors/Vault/VaultDelete.h index 8d1f214885..f881a692fd 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.h +++ b/include/xrpl/tx/transactors/Vault/VaultDelete.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDeposit.h b/include/xrpl/tx/transactors/Vault/VaultDeposit.h similarity index 90% rename from src/xrpld/app/tx/detail/VaultDeposit.h rename to include/xrpl/tx/transactors/Vault/VaultDeposit.h index 6c63308407..0943596f20 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.h +++ b/include/xrpl/tx/transactors/Vault/VaultDeposit.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultSet.h b/include/xrpl/tx/transactors/Vault/VaultSet.h similarity index 91% rename from src/xrpld/app/tx/detail/VaultSet.h rename to include/xrpl/tx/transactors/Vault/VaultSet.h index 1e8a15291e..fb69f132b1 100644 --- a/src/xrpld/app/tx/detail/VaultSet.h +++ b/include/xrpl/tx/transactors/Vault/VaultSet.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.h b/include/xrpl/tx/transactors/Vault/VaultWithdraw.h similarity index 90% rename from src/xrpld/app/tx/detail/VaultWithdraw.h rename to include/xrpl/tx/transactors/Vault/VaultWithdraw.h index f832c206f8..ffe14a7141 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.h +++ b/include/xrpl/tx/transactors/Vault/VaultWithdraw.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/XChainBridge.h b/include/xrpl/tx/transactors/XChainBridge.h similarity index 99% rename from src/xrpld/app/tx/detail/XChainBridge.h rename to include/xrpl/tx/transactors/XChainBridge.h index 3d0c250f24..0a2fccc18b 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.h +++ b/include/xrpl/tx/transactors/XChainBridge.h @@ -1,8 +1,7 @@ #pragma once -#include - #include +#include namespace xrpl { diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index 1651e8aba2..30dd60698e 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -773,7 +773,8 @@ Number::operator/=(Number const& y) return *this; } -Number::operator rep() const +Number:: +operator rep() const { rep drops = mantissa(); int offset = exponent(); diff --git a/src/libxrpl/json/json_value.cpp b/src/libxrpl/json/json_value.cpp index edbbafc1eb..a7692c7683 100644 --- a/src/libxrpl/json/json_value.cpp +++ b/src/libxrpl/json/json_value.cpp @@ -777,7 +777,8 @@ Value::size() const return 0; // unreachable; } -Value::operator bool() const +Value:: +operator bool() const { if (isNull()) return false; diff --git a/src/libxrpl/protocol/Feature.cpp b/src/libxrpl/protocol/Feature.cpp index 834341f8d6..149888a3a8 100644 --- a/src/libxrpl/protocol/Feature.cpp +++ b/src/libxrpl/protocol/Feature.cpp @@ -89,7 +89,7 @@ class FeatureCollections }; // Intermediate types to help with readability - template + template using feature_hashed_unique = boost::multi_index:: hashed_unique, boost::multi_index::member>; diff --git a/src/libxrpl/protocol/Protocol.cpp b/src/libxrpl/protocol/Protocol.cpp new file mode 100644 index 0000000000..6f86f49fc6 --- /dev/null +++ b/src/libxrpl/protocol/Protocol.cpp @@ -0,0 +1,15 @@ +#include + +namespace xrpl { +bool +isVotingLedger(LedgerIndex seq) +{ + return seq % FLAG_LEDGER_INTERVAL == 0; +} + +bool +isFlagLedger(LedgerIndex seq) +{ + return seq % FLAG_LEDGER_INTERVAL == 0; +} +} // namespace xrpl diff --git a/src/libxrpl/protocol/digest.cpp b/src/libxrpl/protocol/digest.cpp index aa5600dde0..0e03882c3c 100644 --- a/src/libxrpl/protocol/digest.cpp +++ b/src/libxrpl/protocol/digest.cpp @@ -21,7 +21,8 @@ openssl_ripemd160_hasher::operator()(void const* data, std::size_t size) noexcep RIPEMD160_Update(ctx, data, size); } -openssl_ripemd160_hasher::operator result_type() noexcept +openssl_ripemd160_hasher:: +operator result_type() noexcept { auto const ctx = reinterpret_cast(ctx_); result_type digest; @@ -45,7 +46,8 @@ openssl_sha512_hasher::operator()(void const* data, std::size_t size) noexcept SHA512_Update(ctx, data, size); } -openssl_sha512_hasher::operator result_type() noexcept +openssl_sha512_hasher:: +operator result_type() noexcept { auto const ctx = reinterpret_cast(ctx_); result_type digest; @@ -69,7 +71,8 @@ openssl_sha256_hasher::operator()(void const* data, std::size_t size) noexcept SHA256_Update(ctx, data, size); } -openssl_sha256_hasher::operator result_type() noexcept +openssl_sha256_hasher:: +operator result_type() noexcept { auto const ctx = reinterpret_cast(ctx_); result_type digest; diff --git a/src/libxrpl/server/JSONRPCUtil.cpp b/src/libxrpl/server/JSONRPCUtil.cpp index 634bb07850..d32a579d8d 100644 --- a/src/libxrpl/server/JSONRPCUtil.cpp +++ b/src/libxrpl/server/JSONRPCUtil.cpp @@ -19,9 +19,7 @@ getHTTPHeaderTimestamp() char buffer[96]; time_t now; time(&now); - struct tm now_gmt - { - }; + struct tm now_gmt{}; #ifndef _MSC_VER gmtime_r(&now, &now_gmt); #else diff --git a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp b/src/libxrpl/server/LoadFeeTrack.cpp similarity index 98% rename from src/xrpld/app/misc/detail/LoadFeeTrack.cpp rename to src/libxrpl/server/LoadFeeTrack.cpp index 91a40c6a9d..e3867f36f5 100644 --- a/src/xrpld/app/misc/detail/LoadFeeTrack.cpp +++ b/src/libxrpl/server/LoadFeeTrack.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include #include diff --git a/src/libxrpl/server/Wallet.cpp b/src/libxrpl/server/Wallet.cpp index 51f1326674..6b7c285b3e 100644 --- a/src/libxrpl/server/Wallet.cpp +++ b/src/libxrpl/server/Wallet.cpp @@ -124,8 +124,9 @@ getNodeIdentity(soci::session& session) auto [newpublicKey, newsecretKey] = randomKeyPair(KeyType::secp256k1); session << str( - boost::format("INSERT INTO NodeIdentity (PublicKey,PrivateKey) " - "VALUES ('%s','%s');") % + boost::format( + "INSERT INTO NodeIdentity (PublicKey,PrivateKey) " + "VALUES ('%s','%s');") % toBase58(TokenType::NodePublic, newpublicKey) % toBase58(TokenType::NodePrivate, newsecretKey)); return {newpublicKey, newsecretKey}; diff --git a/src/libxrpl/shamap/SHAMapDelta.cpp b/src/libxrpl/shamap/SHAMapDelta.cpp index d8aabcc67c..1335fd0532 100644 --- a/src/libxrpl/shamap/SHAMapDelta.cpp +++ b/src/libxrpl/shamap/SHAMapDelta.cpp @@ -276,45 +276,46 @@ SHAMap::walkMapParallel(std::vector& missingNodes, int maxMis nodeStacks[rootChildIndex].push(intr_ptr::static_pointer_cast(child)); JLOG(journal_.debug()) << "starting worker " << rootChildIndex; - workers.push_back(std::thread( - [&m, &missingNodes, &maxMissing, &exceptions, this]( - std::stack> nodeStack) { - try - { - while (!nodeStack.empty()) + workers.push_back( + std::thread( + [&m, &missingNodes, &maxMissing, &exceptions, this]( + std::stack> nodeStack) { + try { - intr_ptr::SharedPtr node = std::move(nodeStack.top()); - XRPL_ASSERT(node, "xrpl::SHAMap::walkMapParallel : non-null node"); - nodeStack.pop(); - - for (int i = 0; i < 16; ++i) + while (!nodeStack.empty()) { - if (node->isEmptyBranch(i)) - continue; - intr_ptr::SharedPtr nextNode = descendNoStore(*node, i); + intr_ptr::SharedPtr node = std::move(nodeStack.top()); + XRPL_ASSERT(node, "xrpl::SHAMap::walkMapParallel : non-null node"); + nodeStack.pop(); - if (nextNode) + for (int i = 0; i < 16; ++i) { - if (nextNode->isInner()) - nodeStack.push(intr_ptr::static_pointer_cast(nextNode)); - } - else - { - std::lock_guard l{m}; - missingNodes.emplace_back(type_, node->getChildHash(i)); - if (--maxMissing <= 0) - return; + if (node->isEmptyBranch(i)) + continue; + intr_ptr::SharedPtr nextNode = descendNoStore(*node, i); + + if (nextNode) + { + if (nextNode->isInner()) + nodeStack.push(intr_ptr::static_pointer_cast(nextNode)); + } + else + { + std::lock_guard l{m}; + missingNodes.emplace_back(type_, node->getChildHash(i)); + if (--maxMissing <= 0) + return; + } } } } - } - catch (SHAMapMissingNode const& e) - { - std::lock_guard l(m); - exceptions.push_back(e); - } - }, - std::move(nodeStacks[rootChildIndex]))); + catch (SHAMapMissingNode const& e) + { + std::lock_guard l(m); + exceptions.push_back(e); + } + }, + std::move(nodeStacks[rootChildIndex]))); } for (std::thread& worker : workers) diff --git a/src/xrpld/app/tx/detail/ApplyContext.cpp b/src/libxrpl/tx/ApplyContext.cpp similarity index 96% rename from src/xrpld/app/tx/detail/ApplyContext.cpp rename to src/libxrpl/tx/ApplyContext.cpp index c5b4d31cec..1258d36a50 100644 --- a/src/xrpld/app/tx/detail/ApplyContext.cpp +++ b/src/libxrpl/tx/ApplyContext.cpp @@ -1,14 +1,13 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { ApplyContext::ApplyContext( - Application& app_, + ServiceRegistry& registry_, OpenView& base, std::optional const& parentBatchId, STTx const& tx_, @@ -16,7 +15,7 @@ ApplyContext::ApplyContext( XRPAmount baseFee_, ApplyFlags flags, beast::Journal journal_) - : app(app_) + : registry(registry_) , tx(tx_) , preclaimResult(preclaimResult_) , baseFee(baseFee_) diff --git a/src/xrpld/app/tx/detail/InvariantCheck.cpp b/src/libxrpl/tx/InvariantCheck.cpp similarity index 99% rename from src/xrpld/app/tx/detail/InvariantCheck.cpp rename to src/libxrpl/tx/InvariantCheck.cpp index 24a37270ce..c1ba2ac4ea 100644 --- a/src/xrpld/app/tx/detail/InvariantCheck.cpp +++ b/src/libxrpl/tx/InvariantCheck.cpp @@ -1,9 +1,3 @@ -#include -#include -#include -#include -#include - #include #include #include @@ -21,6 +15,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include diff --git a/src/xrpld/app/tx/detail/SignerEntries.cpp b/src/libxrpl/tx/SignerEntries.cpp similarity index 95% rename from src/xrpld/app/tx/detail/SignerEntries.cpp rename to src/libxrpl/tx/SignerEntries.cpp index 3526148638..aca1f2c19a 100644 --- a/src/xrpld/app/tx/detail/SignerEntries.cpp +++ b/src/libxrpl/tx/SignerEntries.cpp @@ -1,8 +1,8 @@ -#include - #include #include #include +#include +#include #include #include diff --git a/src/xrpld/app/tx/detail/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp similarity index 97% rename from src/xrpld/app/tx/detail/Transactor.cpp rename to src/libxrpl/tx/Transactor.cpp index a7bb7992fb..3545004efa 100644 --- a/src/xrpld/app/tx/detail/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -1,12 +1,6 @@ -#include -#include -#include -#include -#include -#include - #include #include +#include #include #include #include @@ -16,6 +10,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include namespace xrpl { @@ -32,7 +32,7 @@ preflight0(PreflightContext const& ctx, std::uint32_t flagMask) if (!isPseudoTx(ctx.tx) || ctx.tx.isFieldPresent(sfNetworkID)) { - uint32_t nodeNID = ctx.app.config().NETWORK_ID; + uint32_t nodeNID = ctx.registry.getNetworkIDService().getNetworkID(); std::optional txNID = ctx.tx[~sfNetworkID]; if (nodeNID <= 1024) @@ -204,7 +204,7 @@ Transactor::preflight2(PreflightContext const& ctx) // Do not add any checks after this point that are relevant for // batch inner transactions. They will be skipped. - auto const sigValid = checkValidity(ctx.app.getHashRouter(), ctx.tx, ctx.rules, ctx.app.config()); + auto const sigValid = checkValidity(ctx.registry.getHashRouter(), ctx.tx, ctx.rules); if (sigValid.first == Validity::SigBad) { // LCOV_EXCL_START JLOG(ctx.j.debug()) << "preflight2: bad signature. " << sigValid.second; @@ -303,9 +303,9 @@ Transactor::calculateOwnerReserveFee(ReadView const& view, STTx const& tx) } XRPAmount -Transactor::minimumFee(Application& app, XRPAmount baseFee, Fees const& fees, ApplyFlags flags) +Transactor::minimumFee(ServiceRegistry& registry, XRPAmount baseFee, Fees const& fees, ApplyFlags flags) { - return scaleFeeLoad(baseFee, app.getFeeTrack(), fees, flags & tapUNLIMITED); + return scaleFeeLoad(baseFee, registry.getFeeTrack(), fees, flags & tapUNLIMITED); } TER @@ -331,7 +331,7 @@ Transactor::checkFee(PreclaimContext const& ctx, XRPAmount baseFee) // Only check fee is sufficient when the ledger is open. if (ctx.view.open()) { - auto const feeDue = minimumFee(ctx.app, baseFee, ctx.view.fees(), ctx.flags); + auto const feeDue = minimumFee(ctx.registry, baseFee, ctx.view.fees(), ctx.flags); if (feePaid < feeDue) { @@ -1071,7 +1071,7 @@ Transactor::operator()() } #endif - if (auto const& trap = ctx_.app.trapTxID(); trap && *trap == ctx_.tx.getTransactionID()) + if (auto const& trap = ctx_.registry.trapTxID(); trap && *trap == ctx_.tx.getTransactionID()) { trapTransaction(*trap); } @@ -1172,16 +1172,16 @@ Transactor::operator()() // If necessary, remove any offers found unfunded during processing if ((result == tecOVERSIZE) || (result == tecKILLED)) - removeUnfundedOffers(view(), removedOffers, ctx_.app.journal("View")); + removeUnfundedOffers(view(), removedOffers, ctx_.registry.journal("View")); if (result == tecEXPIRED) - removeExpiredNFTokenOffers(view(), expiredNFTokenOffers, ctx_.app.journal("View")); + removeExpiredNFTokenOffers(view(), expiredNFTokenOffers, ctx_.registry.journal("View")); if (result == tecINCOMPLETE) - removeDeletedTrustLines(view(), removedTrustLines, ctx_.app.journal("View")); + removeDeletedTrustLines(view(), removedTrustLines, ctx_.registry.journal("View")); if (result == tecEXPIRED) - removeExpiredCredentials(view(), expiredCredentials, ctx_.app.journal("View")); + removeExpiredCredentials(view(), expiredCredentials, ctx_.registry.journal("View")); applied = isTecClaim(result); } diff --git a/src/xrpld/app/tx/detail/apply.cpp b/src/libxrpl/tx/apply.cpp similarity index 86% rename from src/xrpld/app/tx/detail/apply.cpp rename to src/libxrpl/tx/apply.cpp index 1c7a509007..2d2df75173 100644 --- a/src/xrpld/app/tx/detail/apply.cpp +++ b/src/libxrpl/tx/apply.cpp @@ -1,11 +1,10 @@ -#include -#include - #include #include #include #include #include +#include +#include namespace xrpl { @@ -19,7 +18,7 @@ constexpr HashRouterFlags SF_LOCALGOOD = HashRouterFlags::PRIVATE4; // Local ch //------------------------------------------------------------------------------ std::pair -checkValidity(HashRouter& router, STTx const& tx, Rules const& rules, Config const& config) +checkValidity(HashRouter& router, STTx const& tx, Rules const& rules) { auto const id = tx.getTransactionID(); auto const flags = router.getFlags(id); @@ -108,32 +107,33 @@ forceValidity(HashRouter& router, uint256 const& txid, Validity validity) template ApplyResult -apply(Application& app, OpenView& view, PreflightChecks&& preflightChecks) +apply(ServiceRegistry& registry, OpenView& view, PreflightChecks&& preflightChecks) { NumberSO stNumberSO{view.rules().enabled(fixUniversalNumber)}; - return doApply(preclaim(preflightChecks(), app, view), app, view); + return doApply(preclaim(preflightChecks(), registry, view), registry, view); } ApplyResult -apply(Application& app, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal j) +apply(ServiceRegistry& registry, OpenView& view, STTx const& tx, ApplyFlags flags, beast::Journal j) { - return apply(app, view, [&]() mutable { return preflight(app, view.rules(), tx, flags, j); }); + return apply(registry, view, [&]() mutable { return preflight(registry, view.rules(), tx, flags, j); }); } ApplyResult apply( - Application& app, + ServiceRegistry& registry, OpenView& view, uint256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j) { - return apply(app, view, [&]() mutable { return preflight(app, view.rules(), parentBatchId, tx, flags, j); }); + return apply( + registry, view, [&]() mutable { return preflight(registry, view.rules(), parentBatchId, tx, flags, j); }); } static bool -applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchTxn, beast::Journal j) +applyBatchTransactions(ServiceRegistry& registry, OpenView& batchView, STTx const& batchTxn, beast::Journal j) { XRPL_ASSERT( batchTxn.getTxnType() == ttBATCH && batchTxn.getFieldArray(sfRawTransactions).size() != 0, @@ -142,10 +142,10 @@ applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchT auto const parentBatchId = batchTxn.getTransactionID(); auto const mode = batchTxn.getFlags(); - auto applyOneTransaction = [&app, &j, &parentBatchId, &batchView](STTx&& tx) { + auto applyOneTransaction = [®istry, &j, &parentBatchId, &batchView](STTx&& tx) { OpenView perTxBatchView(batch_view, batchView); - auto const ret = apply(app, perTxBatchView, parentBatchId, tx, tapBATCH, j); + auto const ret = apply(registry, perTxBatchView, parentBatchId, tx, tapBATCH, j); XRPL_ASSERT( ret.applied == (isTesSuccess(ret.ter) || isTecClaim(ret.ter)), "Inner transaction should not be applied"); @@ -189,7 +189,7 @@ applyBatchTransactions(Application& app, OpenView& batchView, STTx const& batchT ApplyTransactionResult applyTransaction( - Application& app, + ServiceRegistry& registry, OpenView& view, STTx const& txn, bool retryAssured, @@ -204,7 +204,7 @@ applyTransaction( try { - auto const result = apply(app, view, txn, flags, j); + auto const result = apply(registry, view, txn, flags, j); if (result.applied) { @@ -216,7 +216,7 @@ applyTransaction( { OpenView wholeBatchView(batch_view, view); - if (applyBatchTransactions(app, wholeBatchView, txn, j)) + if (applyBatchTransactions(registry, wholeBatchView, txn, j)) wholeBatchView.apply(view); } diff --git a/src/xrpld/app/tx/detail/applySteps.cpp b/src/libxrpl/tx/applySteps.cpp similarity index 94% rename from src/xrpld/app/tx/detail/applySteps.cpp rename to src/libxrpl/tx/applySteps.cpp index 06f0db1a79..3d5c1486f4 100644 --- a/src/xrpld/app/tx/detail/applySteps.cpp +++ b/src/libxrpl/tx/applySteps.cpp @@ -1,4 +1,4 @@ -#include +#include #pragma push_macro("TRANSACTION") #undef TRANSACTION @@ -14,6 +14,7 @@ // DO NOT INCLUDE TRANSACTOR HEADER FILES HERE. // See the instructions at the top of transactions.macro instead. +#include #include #include @@ -292,9 +293,9 @@ invoke_apply(ApplyContext& ctx) } PreflightResult -preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j) +preflight(ServiceRegistry& registry, Rules const& rules, STTx const& tx, ApplyFlags flags, beast::Journal j) { - PreflightContext const pfCtx(app, tx, rules, flags, j); + PreflightContext const pfCtx(registry, tx, rules, flags, j); try { return {pfCtx, invoke_preflight(pfCtx)}; @@ -308,14 +309,14 @@ preflight(Application& app, Rules const& rules, STTx const& tx, ApplyFlags flags PreflightResult preflight( - Application& app, + ServiceRegistry& registry, Rules const& rules, uint256 const& parentBatchId, STTx const& tx, ApplyFlags flags, beast::Journal j) { - PreflightContext const pfCtx(app, tx, parentBatchId, rules, flags, j); + PreflightContext const pfCtx(registry, tx, parentBatchId, rules, flags, j); try { return {pfCtx, invoke_preflight(pfCtx)}; @@ -328,7 +329,7 @@ preflight( } PreclaimResult -preclaim(PreflightResult const& preflightResult, Application& app, OpenView const& view) +preclaim(PreflightResult const& preflightResult, ServiceRegistry& registry, OpenView const& view) { std::optional ctx; if (preflightResult.rules != view.rules()) @@ -336,18 +337,18 @@ preclaim(PreflightResult const& preflightResult, Application& app, OpenView cons auto secondFlight = [&]() { if (preflightResult.parentBatchId) return preflight( - app, + registry, view.rules(), preflightResult.parentBatchId.value(), preflightResult.tx, preflightResult.flags, preflightResult.j); - return preflight(app, view.rules(), preflightResult.tx, preflightResult.flags, preflightResult.j); + return preflight(registry, view.rules(), preflightResult.tx, preflightResult.flags, preflightResult.j); }(); ctx.emplace( - app, + registry, view, secondFlight.ter, secondFlight.tx, @@ -358,7 +359,7 @@ preclaim(PreflightResult const& preflightResult, Application& app, OpenView cons else { ctx.emplace( - app, + registry, view, preflightResult.ter, preflightResult.tx, @@ -393,7 +394,7 @@ calculateDefaultBaseFee(ReadView const& view, STTx const& tx) } ApplyResult -doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) +doApply(PreclaimResult const& preclaimResult, ServiceRegistry& registry, OpenView& view) { if (preclaimResult.view.seq() != view.seq()) { @@ -406,7 +407,7 @@ doApply(PreclaimResult const& preclaimResult, Application& app, OpenView& view) if (!preclaimResult.likelyToClaimFee) return {preclaimResult.ter, false}; ApplyContext ctx( - app, + registry, view, preclaimResult.parentBatchId, preclaimResult.tx, diff --git a/src/xrpld/app/tx/detail/BookTip.cpp b/src/libxrpl/tx/paths/BookTip.cpp similarity index 97% rename from src/xrpld/app/tx/detail/BookTip.cpp rename to src/libxrpl/tx/paths/BookTip.cpp index 61010c0caa..f00da6d7c7 100644 --- a/src/xrpld/app/tx/detail/BookTip.cpp +++ b/src/libxrpl/tx/paths/BookTip.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/xrpld/app/paths/Flow.cpp b/src/libxrpl/tx/paths/Flow.cpp similarity index 95% rename from src/xrpld/app/paths/Flow.cpp rename to src/libxrpl/tx/paths/Flow.cpp index 1f6d29bfb9..d1c25a353c 100644 --- a/src/xrpld/app/paths/Flow.cpp +++ b/src/libxrpl/tx/paths/Flow.cpp @@ -1,13 +1,12 @@ -#include -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/OfferStream.cpp b/src/libxrpl/tx/paths/OfferStream.cpp similarity index 99% rename from src/xrpld/app/tx/detail/OfferStream.cpp rename to src/libxrpl/tx/paths/OfferStream.cpp index 9f013de607..ee74d94d7d 100644 --- a/src/xrpld/app/tx/detail/OfferStream.cpp +++ b/src/libxrpl/tx/paths/OfferStream.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/paths/RippleCalc.cpp b/src/libxrpl/tx/paths/RippleCalc.cpp similarity index 96% rename from src/xrpld/app/paths/RippleCalc.cpp rename to src/libxrpl/tx/paths/RippleCalc.cpp index 0667e1971c..ba40e031cc 100644 --- a/src/xrpld/app/paths/RippleCalc.cpp +++ b/src/libxrpl/tx/paths/RippleCalc.cpp @@ -1,10 +1,9 @@ -#include -#include -#include - #include #include #include +#include +#include +#include namespace xrpl { namespace path { diff --git a/src/xrpld/app/tx/detail/AMMBid.cpp b/src/libxrpl/tx/transactors/AMM/AMMBid.cpp similarity index 98% rename from src/xrpld/app/tx/detail/AMMBid.cpp rename to src/libxrpl/tx/transactors/AMM/AMMBid.cpp index 1d0c30c1f0..b54fb34be9 100644 --- a/src/xrpld/app/tx/detail/AMMBid.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMBid.cpp @@ -1,13 +1,12 @@ -#include -#include -#include - #include #include #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMClawback.cpp b/src/libxrpl/tx/transactors/AMM/AMMClawback.cpp similarity index 97% rename from src/xrpld/app/tx/detail/AMMClawback.cpp rename to src/libxrpl/tx/transactors/AMM/AMMClawback.cpp index 6da899c578..19aebecb27 100644 --- a/src/xrpld/app/tx/detail/AMMClawback.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMClawback.cpp @@ -1,14 +1,13 @@ -#include -#include -#include -#include - #include #include #include #include #include #include +#include +#include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/AMMCreate.cpp b/src/libxrpl/tx/transactors/AMM/AMMCreate.cpp similarity index 98% rename from src/xrpld/app/tx/detail/AMMCreate.cpp rename to src/libxrpl/tx/transactors/AMM/AMMCreate.cpp index aa75a18e30..432fb716b7 100644 --- a/src/xrpld/app/tx/detail/AMMCreate.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMCreate.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include #include #include @@ -9,6 +5,9 @@ #include #include #include +#include +#include +#include namespace xrpl { @@ -272,7 +271,7 @@ applyCreate(ApplyContext& ctx_, Sandbox& sb, AccountID const& account_, beast::J Book const book{issueIn, issueOut, std::nullopt}; auto const dir = keylet::quality(keylet::book(book), uRate); if (auto const bookExisted = static_cast(sb.read(dir)); !bookExisted) - ctx_.app.getOrderBookDB().addOrderBook(book); + ctx_.registry.getOrderBookDB().addOrderBook(book); }; addOrderBook(amount.issue(), amount2.issue(), getRate(amount2, amount)); addOrderBook(amount2.issue(), amount.issue(), getRate(amount, amount2)); diff --git a/src/xrpld/app/tx/detail/AMMDelete.cpp b/src/libxrpl/tx/transactors/AMM/AMMDelete.cpp similarity index 92% rename from src/xrpld/app/tx/detail/AMMDelete.cpp rename to src/libxrpl/tx/transactors/AMM/AMMDelete.cpp index f810f57758..d11e8f225c 100644 --- a/src/xrpld/app/tx/detail/AMMDelete.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMDelete.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMDeposit.cpp b/src/libxrpl/tx/transactors/AMM/AMMDeposit.cpp similarity index 99% rename from src/xrpld/app/tx/detail/AMMDeposit.cpp rename to src/libxrpl/tx/transactors/AMM/AMMDeposit.cpp index af4ce51894..83917246c6 100644 --- a/src/xrpld/app/tx/detail/AMMDeposit.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMDeposit.cpp @@ -1,12 +1,11 @@ -#include -#include -#include - #include #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/AMMHelpers.cpp b/src/libxrpl/tx/transactors/AMM/AMMHelpers.cpp similarity index 99% rename from src/xrpld/app/misc/detail/AMMHelpers.cpp rename to src/libxrpl/tx/transactors/AMM/AMMHelpers.cpp index ff3474f33d..28e1b8adf7 100644 --- a/src/xrpld/app/misc/detail/AMMHelpers.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMHelpers.cpp @@ -1,4 +1,4 @@ -#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/AMMUtils.cpp b/src/libxrpl/tx/transactors/AMM/AMMUtils.cpp similarity index 99% rename from src/xrpld/app/misc/detail/AMMUtils.cpp rename to src/libxrpl/tx/transactors/AMM/AMMUtils.cpp index 36a40f1709..0ae1903928 100644 --- a/src/xrpld/app/misc/detail/AMMUtils.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMUtils.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMVote.cpp b/src/libxrpl/tx/transactors/AMM/AMMVote.cpp similarity index 98% rename from src/xrpld/app/tx/detail/AMMVote.cpp rename to src/libxrpl/tx/transactors/AMM/AMMVote.cpp index 05b23233a4..2ef281b70f 100644 --- a/src/xrpld/app/tx/detail/AMMVote.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMVote.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/AMMWithdraw.cpp b/src/libxrpl/tx/transactors/AMM/AMMWithdraw.cpp similarity index 99% rename from src/xrpld/app/tx/detail/AMMWithdraw.cpp rename to src/libxrpl/tx/transactors/AMM/AMMWithdraw.cpp index 58d1e066d6..bf00223660 100644 --- a/src/xrpld/app/tx/detail/AMMWithdraw.cpp +++ b/src/libxrpl/tx/transactors/AMM/AMMWithdraw.cpp @@ -1,11 +1,10 @@ -#include -#include -#include - #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/Batch.cpp b/src/libxrpl/tx/transactors/Batch.cpp similarity index 98% rename from src/xrpld/app/tx/detail/Batch.cpp rename to src/libxrpl/tx/transactors/Batch.cpp index 81f39193cb..faa756a56f 100644 --- a/src/xrpld/app/tx/detail/Batch.cpp +++ b/src/libxrpl/tx/transactors/Batch.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -9,6 +6,8 @@ #include #include #include +#include +#include namespace xrpl { @@ -296,7 +295,7 @@ Batch::preflight(PreflightContext const& ctx) } auto const innerAccount = stx.getAccountID(sfAccount); - if (auto const preflightResult = xrpl::preflight(ctx.app, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j); + if (auto const preflightResult = xrpl::preflight(ctx.registry, ctx.rules, parentBatchId, stx, tapBATCH, ctx.j); preflightResult.ter != tesSUCCESS) { JLOG(ctx.j.debug()) << "BatchTrace[" << parentBatchId << "]: " diff --git a/src/xrpld/app/tx/detail/Change.cpp b/src/libxrpl/tx/transactors/Change.cpp similarity index 96% rename from src/xrpld/app/tx/detail/Change.cpp rename to src/libxrpl/tx/transactors/Change.cpp index 67c7db68c5..eea3da6072 100644 --- a/src/xrpld/app/tx/detail/Change.cpp +++ b/src/libxrpl/tx/transactors/Change.cpp @@ -1,14 +1,11 @@ -#include -#include -#include -#include - #include +#include #include #include #include #include #include +#include #include @@ -195,7 +192,7 @@ Change::applyAmendment() entry[sfAmendment] = amendment; entry[sfCloseTime] = view().parentCloseTime().time_since_epoch().count(); - if (!ctx_.app.getAmendmentTable().isSupported(amendment)) + if (!ctx_.registry.getAmendmentTable().isSupported(amendment)) { JLOG(j_.warn()) << "Unsupported amendment " << amendment << " received a majority."; } @@ -206,12 +203,12 @@ Change::applyAmendment() amendments.push_back(amendment); amendmentObject->setFieldV256(sfAmendments, amendments); - ctx_.app.getAmendmentTable().enable(amendment); + ctx_.registry.getAmendmentTable().enable(amendment); - if (!ctx_.app.getAmendmentTable().isSupported(amendment)) + if (!ctx_.registry.getAmendmentTable().isSupported(amendment)) { JLOG(j_.error()) << "Unsupported amendment " << amendment << " activated: server blocked."; - ctx_.app.getOPs().setAmendmentBlocked(); + ctx_.registry.getOPs().setAmendmentBlocked(); } } diff --git a/src/xrpld/app/tx/detail/CancelCheck.cpp b/src/libxrpl/tx/transactors/Check/CancelCheck.cpp similarity index 96% rename from src/xrpld/app/tx/detail/CancelCheck.cpp rename to src/libxrpl/tx/transactors/Check/CancelCheck.cpp index 086a126eb4..c9a947ae6a 100644 --- a/src/xrpld/app/tx/detail/CancelCheck.cpp +++ b/src/libxrpl/tx/transactors/Check/CancelCheck.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include namespace xrpl { @@ -62,7 +61,7 @@ CancelCheck::doApply() AccountID const srcId{sleCheck->getAccountID(sfAccount)}; AccountID const dstId{sleCheck->getAccountID(sfDestination)}; - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); // If the check is not written to self (and it shouldn't be), remove the // check from the destination account root. diff --git a/src/xrpld/app/tx/detail/CashCheck.cpp b/src/libxrpl/tx/transactors/Check/CashCheck.cpp similarity index 99% rename from src/xrpld/app/tx/detail/CashCheck.cpp rename to src/libxrpl/tx/transactors/Check/CashCheck.cpp index 2cc25924a1..2f5b371c65 100644 --- a/src/xrpld/app/tx/detail/CashCheck.cpp +++ b/src/libxrpl/tx/transactors/Check/CashCheck.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -8,6 +5,8 @@ #include #include #include +#include +#include #include @@ -228,7 +227,7 @@ CashCheck::doApply() // // If it is not a check to self (as should be the case), then there's // work to do... - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); auto const optDeliverMin = ctx_.tx[~sfDeliverMin]; if (srcId != account_) diff --git a/src/xrpld/app/tx/detail/CreateCheck.cpp b/src/libxrpl/tx/transactors/Check/CreateCheck.cpp similarity index 98% rename from src/xrpld/app/tx/detail/CreateCheck.cpp rename to src/libxrpl/tx/transactors/Check/CreateCheck.cpp index d10863df46..8f3a0dbdb0 100644 --- a/src/xrpld/app/tx/detail/CreateCheck.cpp +++ b/src/libxrpl/tx/transactors/Check/CreateCheck.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { @@ -164,7 +163,7 @@ CreateCheck::doApply() view().insert(sleCheck); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); // If it's not a self-send (and it shouldn't be), add Check to the // destination's owner directory. if (dstAccountId != account_) diff --git a/src/xrpld/app/tx/detail/Clawback.cpp b/src/libxrpl/tx/transactors/Clawback.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Clawback.cpp rename to src/libxrpl/tx/transactors/Clawback.cpp index ad4a2f24d0..4fddd26a67 100644 --- a/src/xrpld/app/tx/detail/Clawback.cpp +++ b/src/libxrpl/tx/transactors/Clawback.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/CreateTicket.cpp b/src/libxrpl/tx/transactors/CreateTicket.cpp similarity index 97% rename from src/xrpld/app/tx/detail/CreateTicket.cpp rename to src/libxrpl/tx/transactors/CreateTicket.cpp index eb42904a0b..de61e58b41 100644 --- a/src/xrpld/app/tx/detail/CreateTicket.cpp +++ b/src/libxrpl/tx/transactors/CreateTicket.cpp @@ -1,10 +1,9 @@ -#include - #include #include #include #include #include +#include namespace xrpl { @@ -68,7 +67,7 @@ CreateTicket::doApply() return tecINSUFFICIENT_RESERVE; } - beast::Journal viewJ{ctx_.app.journal("View")}; + beast::Journal viewJ{ctx_.registry.journal("View")}; // The starting ticket sequence is the same as the current account // root sequence. Before we got here to doApply(), the transaction diff --git a/src/xrpld/app/tx/detail/Credentials.cpp b/src/libxrpl/tx/transactors/Credentials.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Credentials.cpp rename to src/libxrpl/tx/transactors/Credentials.cpp index fc3019308a..2dccdf3c15 100644 --- a/src/xrpld/app/tx/detail/Credentials.cpp +++ b/src/libxrpl/tx/transactors/Credentials.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/DID.cpp b/src/libxrpl/tx/transactors/DID.cpp similarity index 99% rename from src/xrpld/app/tx/detail/DID.cpp rename to src/libxrpl/tx/transactors/DID.cpp index 7219dcf60e..216be7ba75 100644 --- a/src/xrpld/app/tx/detail/DID.cpp +++ b/src/libxrpl/tx/transactors/DID.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DelegateSet.cpp b/src/libxrpl/tx/transactors/Delegate/DelegateSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/DelegateSet.cpp rename to src/libxrpl/tx/transactors/Delegate/DelegateSet.cpp index 8dba3ef72e..b2020a60b0 100644 --- a/src/xrpld/app/tx/detail/DelegateSet.cpp +++ b/src/libxrpl/tx/transactors/Delegate/DelegateSet.cpp @@ -1,10 +1,9 @@ -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/DelegateUtils.cpp b/src/libxrpl/tx/transactors/Delegate/DelegateUtils.cpp similarity index 95% rename from src/xrpld/app/misc/detail/DelegateUtils.cpp rename to src/libxrpl/tx/transactors/Delegate/DelegateUtils.cpp index 74ec55cdee..eceb73503f 100644 --- a/src/xrpld/app/misc/detail/DelegateUtils.cpp +++ b/src/libxrpl/tx/transactors/Delegate/DelegateUtils.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace xrpl { NotTEC diff --git a/src/xrpld/app/tx/detail/DeleteAccount.cpp b/src/libxrpl/tx/transactors/DeleteAccount.cpp similarity index 94% rename from src/xrpld/app/tx/detail/DeleteAccount.cpp rename to src/libxrpl/tx/transactors/DeleteAccount.cpp index 18961469a3..9b05bb3aa5 100644 --- a/src/xrpld/app/tx/detail/DeleteAccount.cpp +++ b/src/libxrpl/tx/transactors/DeleteAccount.cpp @@ -1,11 +1,3 @@ -#include -#include -#include -#include -#include -#include -#include - #include #include #include @@ -16,6 +8,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include namespace xrpl { @@ -51,7 +50,7 @@ DeleteAccount::calculateBaseFee(ReadView const& view, STTx const& tx) namespace { // Define a function pointer type that can be used to delete ledger node types. using DeleterFuncPtr = TER (*)( - Application& app, + ServiceRegistry& registry, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -61,7 +60,7 @@ using DeleterFuncPtr = TER (*)( // Local function definitions that provides signature compatibility. TER offerDelete( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -73,19 +72,19 @@ offerDelete( TER removeSignersFromLedger( - Application& app, + ServiceRegistry& registry, ApplyView& view, AccountID const& account, uint256 const& delIndex, std::shared_ptr const& sleDel, beast::Journal j) { - return SetSignerList::removeFromLedger(app, view, account, j); + return SetSignerList::removeFromLedger(registry, view, account, j); } TER removeTicketFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -97,7 +96,7 @@ removeTicketFromLedger( TER removeDepositPreauthFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const&, uint256 const& delIndex, @@ -109,7 +108,7 @@ removeDepositPreauthFromLedger( TER removeNFTokenOfferFromLedger( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -124,7 +123,7 @@ removeNFTokenOfferFromLedger( TER removeDIDFromLedger( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -136,7 +135,7 @@ removeDIDFromLedger( TER removeOracleFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const&, @@ -148,7 +147,7 @@ removeOracleFromLedger( TER removeCredentialFromLedger( - Application&, + ServiceRegistry&, ApplyView& view, AccountID const&, uint256 const&, @@ -160,7 +159,7 @@ removeCredentialFromLedger( TER removeDelegateFromLedger( - Application& app, + ServiceRegistry&, ApplyView& view, AccountID const& account, uint256 const& delIndex, @@ -351,7 +350,7 @@ DeleteAccount::doApply() std::shared_ptr& sleItem) -> std::pair { if (auto deleter = nonObligationDeleter(nodeType)) { - TER const result{deleter(ctx_.app, view(), account_, dirEntry, sleItem, j_)}; + TER const result{deleter(ctx_.registry, view(), account_, dirEntry, sleItem, j_)}; return {result, SkipEntry::No}; } diff --git a/src/xrpld/app/tx/detail/DeleteOracle.cpp b/src/libxrpl/tx/transactors/DeleteOracle.cpp similarity index 97% rename from src/xrpld/app/tx/detail/DeleteOracle.cpp rename to src/libxrpl/tx/transactors/DeleteOracle.cpp index 9b62bffb5f..8f8a29f8a2 100644 --- a/src/xrpld/app/tx/detail/DeleteOracle.cpp +++ b/src/libxrpl/tx/transactors/DeleteOracle.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/DepositPreauth.cpp b/src/libxrpl/tx/transactors/DepositPreauth.cpp similarity index 97% rename from src/xrpld/app/tx/detail/DepositPreauth.cpp rename to src/libxrpl/tx/transactors/DepositPreauth.cpp index 4636bdb359..a72628b5be 100644 --- a/src/xrpld/app/tx/detail/DepositPreauth.cpp +++ b/src/libxrpl/tx/transactors/DepositPreauth.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include #include @@ -120,8 +119,9 @@ DepositPreauth::preclaim(PreclaimContext const& ctx) else if (ctx.tx.isFieldPresent(sfUnauthorizeCredentials)) { // Verify that the Preauth entry is in the ledger. - if (!ctx.view.exists(keylet::depositPreauth( - account, credentials::makeSorted(ctx.tx.getFieldArray(sfUnauthorizeCredentials))))) + if (!ctx.view.exists( + keylet::depositPreauth( + account, credentials::makeSorted(ctx.tx.getFieldArray(sfUnauthorizeCredentials))))) return tecNO_ENTRY; } return tesSUCCESS; diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/libxrpl/tx/transactors/Escrow.cpp similarity index 99% rename from src/xrpld/app/tx/detail/Escrow.cpp rename to src/libxrpl/tx/transactors/Escrow.cpp index dea9d3aa2b..aff6d07cc3 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/libxrpl/tx/transactors/Escrow.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -14,6 +11,8 @@ #include #include #include +#include +#include namespace xrpl { @@ -544,7 +543,7 @@ EscrowFinish::preflightSigValidated(PreflightContext const& ctx) if (cb && fb) { - auto& router = ctx.app.getHashRouter(); + auto& router = ctx.registry.getHashRouter(); auto const id = ctx.tx.getTransactionID(); auto const flags = router.getFlags(id); @@ -900,7 +899,7 @@ EscrowFinish::doApply() // Check cryptocondition fulfillment { auto const id = ctx_.tx.getTransactionID(); - auto flags = ctx_.app.getHashRouter().getFlags(id); + auto flags = ctx_.registry.getHashRouter().getFlags(id); auto const cb = ctx_.tx[~sfCondition]; @@ -920,7 +919,7 @@ EscrowFinish::doApply() else flags = SF_CF_INVALID; - ctx_.app.getHashRouter().setFlags(id, flags); + ctx_.registry.getHashRouter().setFlags(id, flags); // LCOV_EXCL_STOP } diff --git a/src/xrpld/app/tx/detail/LedgerStateFix.cpp b/src/libxrpl/tx/transactors/LedgerStateFix.cpp similarity index 94% rename from src/xrpld/app/tx/detail/LedgerStateFix.cpp rename to src/libxrpl/tx/transactors/LedgerStateFix.cpp index 43001e2fbf..28028b6f2b 100644 --- a/src/xrpld/app/tx/detail/LedgerStateFix.cpp +++ b/src/libxrpl/tx/transactors/LedgerStateFix.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/LendingHelpers.cpp b/src/libxrpl/tx/transactors/Lending/LendingHelpers.cpp similarity index 98% rename from src/xrpld/app/misc/detail/LendingHelpers.cpp rename to src/libxrpl/tx/transactors/Lending/LendingHelpers.cpp index 106eeb9301..13bb321974 100644 --- a/src/xrpld/app/misc/detail/LendingHelpers.cpp +++ b/src/libxrpl/tx/transactors/Lending/LendingHelpers.cpp @@ -1,6 +1,6 @@ -#include +#include // DO NOT REMOVE forces header file include to sort first -#include +#include namespace xrpl { @@ -328,23 +328,24 @@ doPayment( "xrpl::detail::doPayment", "fee outstanding stays valid"); - return LoanPaymentParts{// Principal paid is straightforward - it's the tracked delta - .principalPaid = payment.trackedPrincipalDelta, + return LoanPaymentParts{ + // Principal paid is straightforward - it's the tracked delta + .principalPaid = payment.trackedPrincipalDelta, - // Interest paid combines: - // 1. Tracked interest from the amortization schedule - // (derived from the tracked deltas) - // 2. Untracked interest (e.g., late payment penalties) - .interestPaid = payment.trackedInterestPart() + payment.untrackedInterest, + // Interest paid combines: + // 1. Tracked interest from the amortization schedule + // (derived from the tracked deltas) + // 2. Untracked interest (e.g., late payment penalties) + .interestPaid = payment.trackedInterestPart() + payment.untrackedInterest, - // Value change represents how the loan's total value changed beyond - // normal amortization. - .valueChange = payment.untrackedInterest, + // Value change represents how the loan's total value changed beyond + // normal amortization. + .valueChange = payment.untrackedInterest, - // Fee paid combines: - // 1. Tracked management fees from the amortization schedule - // 2. Untracked fees (e.g., late payment fees, service fees) - .feePaid = payment.trackedManagementFeeDelta + payment.untrackedManagementFee}; + // Fee paid combines: + // 1. Tracked management fees from the amortization schedule + // 2. Untracked fees (e.g., late payment fees, service fees) + .feePaid = payment.trackedManagementFeeDelta + payment.untrackedManagementFee}; } /* Simulates an overpayment to validate it won't break the loan's amortization. diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverClawback.cpp similarity index 98% rename from src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerCoverClawback.cpp index 7038752f8b..819ae54895 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverClawback.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverClawback.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.cpp similarity index 96% rename from src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.cpp index 3dd513414e..d112959fea 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverDeposit.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverDeposit.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.cpp similarity index 97% rename from src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.cpp index f2c8f28a84..43ff3659ef 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerCoverWithdraw.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerCoverWithdraw.cpp @@ -1,10 +1,9 @@ -#include +#include // -#include -#include - #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerDelete.cpp similarity index 97% rename from src/xrpld/app/tx/detail/LoanBrokerDelete.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerDelete.cpp index 7c8b6c1f64..45227144fa 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerDelete.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerDelete.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp b/src/libxrpl/tx/transactors/Lending/LoanBrokerSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/LoanBrokerSet.cpp rename to src/libxrpl/tx/transactors/Lending/LoanBrokerSet.cpp index 9553402f15..cf1cbaa610 100644 --- a/src/xrpld/app/tx/detail/LoanBrokerSet.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanBrokerSet.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanDelete.cpp b/src/libxrpl/tx/transactors/Lending/LoanDelete.cpp similarity index 97% rename from src/xrpld/app/tx/detail/LoanDelete.cpp rename to src/libxrpl/tx/transactors/Lending/LoanDelete.cpp index d975834d29..fb7f0f8cd4 100644 --- a/src/xrpld/app/tx/detail/LoanDelete.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanDelete.cpp @@ -1,8 +1,7 @@ -#include +#include // -#include - #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanManage.cpp b/src/libxrpl/tx/transactors/Lending/LoanManage.cpp similarity index 99% rename from src/xrpld/app/tx/detail/LoanManage.cpp rename to src/libxrpl/tx/transactors/Lending/LoanManage.cpp index 8d0a79686c..6f524010d4 100644 --- a/src/xrpld/app/tx/detail/LoanManage.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanManage.cpp @@ -1,9 +1,8 @@ -#include +#include // -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/libxrpl/tx/transactors/Lending/LoanPay.cpp similarity index 99% rename from src/xrpld/app/tx/detail/LoanPay.cpp rename to src/libxrpl/tx/transactors/Lending/LoanPay.cpp index 744e81d67d..089c862fbb 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanPay.cpp @@ -1,12 +1,11 @@ -#include +#include // -#include -#include - #include #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/libxrpl/tx/transactors/Lending/LoanSet.cpp similarity index 99% rename from src/xrpld/app/tx/detail/LoanSet.cpp rename to src/libxrpl/tx/transactors/Lending/LoanSet.cpp index b7105f5df8..06209d9354 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/libxrpl/tx/transactors/Lending/LoanSet.cpp @@ -1,9 +1,8 @@ -#include +#include // -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenAuthorize.cpp similarity index 98% rename from src/xrpld/app/tx/detail/MPTokenAuthorize.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenAuthorize.cpp index 1eb9a0359a..75d51f39a5 100644 --- a/src/xrpld/app/tx/detail/MPTokenAuthorize.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenAuthorize.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceCreate.cpp similarity index 98% rename from src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenIssuanceCreate.cpp index 9a9dc6a11c..b135113499 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceCreate.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.cpp similarity index 96% rename from src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.cpp index cec06c5494..acdd004bae 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceDestroy.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceDestroy.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp rename to src/libxrpl/tx/transactors/MPT/MPTokenIssuanceSet.cpp index cf3b15ed78..5bad3906a0 100644 --- a/src/xrpld/app/tx/detail/MPTokenIssuanceSet.cpp +++ b/src/libxrpl/tx/transactors/MPT/MPTokenIssuanceSet.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenAcceptOffer.cpp similarity index 99% rename from src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenAcceptOffer.cpp index 349dc2c1ea..57f20fe124 100644 --- a/src/xrpld/app/tx/detail/NFTokenAcceptOffer.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenAcceptOffer.cpp @@ -1,10 +1,9 @@ -#include -#include - #include #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenBurn.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenBurn.cpp similarity index 96% rename from src/xrpld/app/tx/detail/NFTokenBurn.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenBurn.cpp index a6146dcc4e..3aee6e26b3 100644 --- a/src/xrpld/app/tx/detail/NFTokenBurn.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenBurn.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenCancelOffer.cpp similarity index 95% rename from src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenCancelOffer.cpp index f691a1b816..24f2b8687a 100644 --- a/src/xrpld/app/tx/detail/NFTokenCancelOffer.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenCancelOffer.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenCreateOffer.cpp similarity index 94% rename from src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenCreateOffer.cpp index fdf2444ebc..ecf106baaf 100644 --- a/src/xrpld/app/tx/detail/NFTokenCreateOffer.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenCreateOffer.cpp @@ -1,9 +1,8 @@ -#include -#include - #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenMint.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenMint.cpp similarity index 99% rename from src/xrpld/app/tx/detail/NFTokenMint.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenMint.cpp index b00001e8fc..c03e351b0e 100644 --- a/src/xrpld/app/tx/detail/NFTokenMint.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenMint.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/NFTokenModify.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenModify.cpp similarity index 93% rename from src/xrpld/app/tx/detail/NFTokenModify.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenModify.cpp index 15be2d196a..316bcb0f27 100644 --- a/src/xrpld/app/tx/detail/NFTokenModify.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenModify.cpp @@ -1,8 +1,7 @@ -#include -#include - #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/NFTokenUtils.cpp b/src/libxrpl/tx/transactors/NFT/NFTokenUtils.cpp similarity index 99% rename from src/xrpld/app/tx/detail/NFTokenUtils.cpp rename to src/libxrpl/tx/transactors/NFT/NFTokenUtils.cpp index 5581182204..638ee99e36 100644 --- a/src/xrpld/app/tx/detail/NFTokenUtils.cpp +++ b/src/libxrpl/tx/transactors/NFT/NFTokenUtils.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/app/tx/detail/CancelOffer.cpp b/src/libxrpl/tx/transactors/Offer/CancelOffer.cpp similarity index 92% rename from src/xrpld/app/tx/detail/CancelOffer.cpp rename to src/libxrpl/tx/transactors/Offer/CancelOffer.cpp index 1dc9ad0bde..3e5d2441e1 100644 --- a/src/xrpld/app/tx/detail/CancelOffer.cpp +++ b/src/libxrpl/tx/transactors/Offer/CancelOffer.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { @@ -54,7 +53,7 @@ CancelOffer::doApply() if (auto sleOffer = view().peek(keylet::offer(account_, offerSequence))) { JLOG(j_.debug()) << "Trying to cancel offer #" << offerSequence; - return offerDelete(view(), sleOffer, ctx_.app.journal("View")); + return offerDelete(view(), sleOffer, ctx_.registry.journal("View")); } JLOG(j_.debug()) << "Offer #" << offerSequence << " can't be found."; diff --git a/src/xrpld/app/tx/detail/CreateOffer.cpp b/src/libxrpl/tx/transactors/Offer/CreateOffer.cpp similarity index 98% rename from src/xrpld/app/tx/detail/CreateOffer.cpp rename to src/libxrpl/tx/transactors/Offer/CreateOffer.cpp index 666023233d..4b820014af 100644 --- a/src/xrpld/app/tx/detail/CreateOffer.cpp +++ b/src/libxrpl/tx/transactors/Offer/CreateOffer.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include #include #include @@ -11,6 +7,9 @@ #include #include #include +#include +#include +#include namespace xrpl { TxConsequences @@ -144,7 +143,7 @@ CreateOffer::preclaim(PreclaimContext const& ctx) std::uint32_t const uAccountSequence = sleCreator->getFieldU32(sfSequence); - auto viewJ = ctx.app.journal("View"); + auto viewJ = ctx.registry.journal("View"); if (isGlobalFrozen(ctx.view, uPaysIssuerID) || isGlobalFrozen(ctx.view, uGetsIssuerID)) { @@ -489,7 +488,7 @@ CreateOffer::applyHybrid( bookArr.push_back(std::move(bookInfo)); if (!bookExists) - ctx_.app.getOrderBookDB().addOrderBook(book); + ctx_.registry.getOrderBookDB().addOrderBook(book); sleOffer->setFieldArray(sfAdditionalBooks, bookArr); return tesSUCCESS; @@ -523,7 +522,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) // end up on the books. auto uRate = getRate(saTakerGets, saTakerPays); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); TER result = tesSUCCESS; @@ -825,7 +824,7 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel) sb.insert(sleOffer); if (!bookExisted) - ctx_.app.getOrderBookDB().addOrderBook(book); + ctx_.registry.getOrderBookDB().addOrderBook(book); JLOG(j_.debug()) << "final result: success"; diff --git a/src/xrpld/app/tx/detail/PayChan.cpp b/src/libxrpl/tx/transactors/PayChan.cpp similarity index 98% rename from src/xrpld/app/tx/detail/PayChan.cpp rename to src/libxrpl/tx/transactors/PayChan.cpp index baa8770e53..168b89a0f8 100644 --- a/src/xrpld/app/tx/detail/PayChan.cpp +++ b/src/libxrpl/tx/transactors/PayChan.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -12,6 +10,7 @@ #include #include #include +#include namespace xrpl { @@ -310,7 +309,7 @@ PayChanFund::doApply() auto const cancelAfter = (*slep)[~sfCancelAfter]; auto const closeTime = ctx_.view().header().parentCloseTime.time_since_epoch().count(); if ((cancelAfter && closeTime >= *cancelAfter) || (expiration && closeTime >= *expiration)) - return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View")); + return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View")); } if (src != txAccount) @@ -456,7 +455,7 @@ PayChanClaim::doApply() auto const cancelAfter = (*slep)[~sfCancelAfter]; auto const closeTime = ctx_.view().header().parentCloseTime.time_since_epoch().count(); if ((cancelAfter && closeTime >= *cancelAfter) || (curExpiration && closeTime >= *curExpiration)) - return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View")); + return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View")); } if (txAccount != src && txAccount != dst) @@ -513,7 +512,7 @@ PayChanClaim::doApply() { // Channel will close immediately if dry or the receiver closes if (dst == txAccount || (*slep)[sfBalance] == (*slep)[sfAmount]) - return closeChannel(slep, ctx_.view(), k.key, ctx_.app.journal("View")); + return closeChannel(slep, ctx_.view(), k.key, ctx_.registry.journal("View")); auto const settleExpiration = ctx_.view().header().parentCloseTime.time_since_epoch().count() + (*slep)[sfSettleDelay]; diff --git a/src/xrpld/app/tx/detail/Payment.cpp b/src/libxrpl/tx/transactors/Payment.cpp similarity index 98% rename from src/xrpld/app/tx/detail/Payment.cpp rename to src/libxrpl/tx/transactors/Payment.cpp index 390548b7ef..68a81e0d81 100644 --- a/src/xrpld/app/tx/detail/Payment.cpp +++ b/src/libxrpl/tx/transactors/Payment.cpp @@ -1,8 +1,3 @@ -#include -#include -#include -#include - #include #include #include @@ -10,6 +5,10 @@ #include #include #include +#include +#include +#include +#include namespace xrpl { @@ -414,7 +413,7 @@ Payment::doApply() account_, ctx_.tx.getFieldPathSet(sfPaths), ctx_.tx[~sfDomainID], - ctx_.app.logs(), + ctx_.registry.logs(), &rcInput); // VFALCO NOTE We might not need to apply, depending // on the TER. But always applying *should* diff --git a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDEXHelpers.cpp similarity index 97% rename from src/xrpld/app/misc/PermissionedDEXHelpers.cpp rename to src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDEXHelpers.cpp index f88c2ab9d4..891e18ef69 100644 --- a/src/xrpld/app/misc/PermissionedDEXHelpers.cpp +++ b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDEXHelpers.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace xrpl { namespace permissioned_dex { diff --git a/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.cpp similarity index 95% rename from src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp rename to src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.cpp index f979637e27..1d54405688 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainDelete.cpp +++ b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainDelete.cpp @@ -1,7 +1,6 @@ -#include - #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.cpp similarity index 98% rename from src/xrpld/app/tx/detail/PermissionedDomainSet.cpp rename to src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.cpp index 19f68426d1..60400f480a 100644 --- a/src/xrpld/app/tx/detail/PermissionedDomainSet.cpp +++ b/src/libxrpl/tx/transactors/PermissionedDomain/PermissionedDomainSet.cpp @@ -1,9 +1,8 @@ -#include - #include #include #include #include +#include #include diff --git a/src/xrpld/app/tx/detail/SetAccount.cpp b/src/libxrpl/tx/transactors/SetAccount.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetAccount.cpp rename to src/libxrpl/tx/transactors/SetAccount.cpp index 41804c9211..fad6d1e318 100644 --- a/src/xrpld/app/tx/detail/SetAccount.cpp +++ b/src/libxrpl/tx/transactors/SetAccount.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -8,6 +5,8 @@ #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetOracle.cpp b/src/libxrpl/tx/transactors/SetOracle.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetOracle.cpp rename to src/libxrpl/tx/transactors/SetOracle.cpp index 73ef1c7ae2..f7ca6a7563 100644 --- a/src/xrpld/app/tx/detail/SetOracle.cpp +++ b/src/libxrpl/tx/transactors/SetOracle.cpp @@ -1,11 +1,10 @@ -#include - #include #include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/SetRegularKey.cpp b/src/libxrpl/tx/transactors/SetRegularKey.cpp similarity index 92% rename from src/xrpld/app/tx/detail/SetRegularKey.cpp rename to src/libxrpl/tx/transactors/SetRegularKey.cpp index 14302c67c4..0e68406f0d 100644 --- a/src/xrpld/app/tx/detail/SetRegularKey.cpp +++ b/src/libxrpl/tx/transactors/SetRegularKey.cpp @@ -1,8 +1,7 @@ -#include - #include #include #include +#include namespace xrpl { @@ -47,7 +46,7 @@ SetRegularKey::doApply() if (!sle) return tefINTERNAL; // LCOV_EXCL_LINE - if (!minimumFee(ctx_.app, ctx_.baseFee, view().fees(), view().flags())) + if (!minimumFee(ctx_.registry, ctx_.baseFee, view().fees(), view().flags())) sle->setFlag(lsfPasswordSpent); if (ctx_.tx.isFieldPresent(sfRegularKey)) diff --git a/src/xrpld/app/tx/detail/SetSignerList.cpp b/src/libxrpl/tx/transactors/SetSignerList.cpp similarity index 94% rename from src/xrpld/app/tx/detail/SetSignerList.cpp rename to src/libxrpl/tx/transactors/SetSignerList.cpp index 1864e82b99..8d736391c0 100644 --- a/src/xrpld/app/tx/detail/SetSignerList.cpp +++ b/src/libxrpl/tx/transactors/SetSignerList.cpp @@ -1,14 +1,13 @@ -#include -#include - #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -151,7 +150,7 @@ signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules) static TER removeSignersFromLedger( - Application& app, + ServiceRegistry& registry, ApplyView& view, Keylet const& accountKeylet, Keylet const& ownerDirKeylet, @@ -187,7 +186,7 @@ removeSignersFromLedger( // LCOV_EXCL_STOP } - adjustOwnerCount(view, view.peek(accountKeylet), removeFromOwnerCount, app.journal("View")); + adjustOwnerCount(view, view.peek(accountKeylet), removeFromOwnerCount, registry.journal("View")); view.erase(signers); @@ -195,13 +194,13 @@ removeSignersFromLedger( } TER -SetSignerList::removeFromLedger(Application& app, ApplyView& view, AccountID const& account, beast::Journal j) +SetSignerList::removeFromLedger(ServiceRegistry& registry, ApplyView& view, AccountID const& account, beast::Journal j) { auto const accountKeylet = keylet::account(account); auto const ownerDirKeylet = keylet::ownerDir(account); auto const signerListKeylet = keylet::signers(account); - return removeSignersFromLedger(app, view, accountKeylet, ownerDirKeylet, signerListKeylet, j); + return removeSignersFromLedger(registry, view, accountKeylet, ownerDirKeylet, signerListKeylet, j); } NotTEC @@ -273,7 +272,8 @@ SetSignerList::replaceSignerList() // This may be either a create or a replace. Preemptively remove any // old signer list. May reduce the reserve, so this is done before // checking the reserve. - if (TER const ter = removeSignersFromLedger(ctx_.app, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_)) + if (TER const ter = + removeSignersFromLedger(ctx_.registry, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_)) return ter; auto const sle = view().peek(accountKeylet); @@ -299,7 +299,7 @@ SetSignerList::replaceSignerList() view().insert(signerList); writeSignersToSLE(signerList, flags); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); // Add the signer list to the account's directory. auto const page = ctx_.view().dirInsert(ownerDirKeylet, signerListKeylet, describeOwnerDir(account_)); @@ -332,7 +332,7 @@ SetSignerList::destroySignerList() auto const ownerDirKeylet = keylet::ownerDir(account_); auto const signerListKeylet = keylet::signers(account_); - return removeSignersFromLedger(ctx_.app, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_); + return removeSignersFromLedger(ctx_.registry, view(), accountKeylet, ownerDirKeylet, signerListKeylet, j_); } void diff --git a/src/xrpld/app/tx/detail/SetTrust.cpp b/src/libxrpl/tx/transactors/SetTrust.cpp similarity index 99% rename from src/xrpld/app/tx/detail/SetTrust.cpp rename to src/libxrpl/tx/transactors/SetTrust.cpp index ce8ca05a09..2d1e94b967 100644 --- a/src/xrpld/app/tx/detail/SetTrust.cpp +++ b/src/libxrpl/tx/transactors/SetTrust.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -9,6 +6,8 @@ #include #include #include +#include +#include namespace { @@ -352,7 +351,7 @@ SetTrust::doApply() bool const bSetDeepFreeze = (uTxFlags & tfSetDeepFreeze); bool const bClearDeepFreeze = (uTxFlags & tfClearDeepFreeze); - auto viewJ = ctx_.app.journal("View"); + auto viewJ = ctx_.registry.journal("View"); SLE::pointer sleDst = view().peek(keylet::account(uDstAccountID)); diff --git a/src/xrpld/app/tx/detail/VaultClawback.cpp b/src/libxrpl/tx/transactors/Vault/VaultClawback.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultClawback.cpp rename to src/libxrpl/tx/transactors/Vault/VaultClawback.cpp index 5aa63fac1a..bbd68907de 100644 --- a/src/xrpld/app/tx/detail/VaultClawback.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultClawback.cpp @@ -1,5 +1,3 @@ -#include -// #include #include #include @@ -9,6 +7,8 @@ #include #include #include +#include +#include #include diff --git a/src/xrpld/app/tx/detail/VaultCreate.cpp b/src/libxrpl/tx/transactors/Vault/VaultCreate.cpp similarity index 97% rename from src/xrpld/app/tx/detail/VaultCreate.cpp rename to src/libxrpl/tx/transactors/Vault/VaultCreate.cpp index 6711a7e13f..c911c496ff 100644 --- a/src/xrpld/app/tx/detail/VaultCreate.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultCreate.cpp @@ -1,7 +1,3 @@ -#include -#include -#include - #include #include #include @@ -14,6 +10,9 @@ #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDelete.cpp b/src/libxrpl/tx/transactors/Vault/VaultDelete.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultDelete.cpp rename to src/libxrpl/tx/transactors/Vault/VaultDelete.cpp index f5c388762f..7d8bf35e5f 100644 --- a/src/xrpld/app/tx/detail/VaultDelete.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultDelete.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -7,6 +5,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/libxrpl/tx/transactors/Vault/VaultDeposit.cpp similarity index 98% rename from src/xrpld/app/tx/detail/VaultDeposit.cpp rename to src/libxrpl/tx/transactors/Vault/VaultDeposit.cpp index d5fc0e4ad6..6f6b425227 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultDeposit.cpp @@ -1,6 +1,3 @@ -#include -#include - #include #include #include @@ -12,6 +9,8 @@ #include #include #include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultSet.cpp b/src/libxrpl/tx/transactors/Vault/VaultSet.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultSet.cpp rename to src/libxrpl/tx/transactors/Vault/VaultSet.cpp index c0aaf5bac6..5257a3089b 100644 --- a/src/xrpld/app/tx/detail/VaultSet.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultSet.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/VaultWithdraw.cpp b/src/libxrpl/tx/transactors/Vault/VaultWithdraw.cpp similarity index 99% rename from src/xrpld/app/tx/detail/VaultWithdraw.cpp rename to src/libxrpl/tx/transactors/Vault/VaultWithdraw.cpp index 88616e34f8..4d0a3c20a5 100644 --- a/src/xrpld/app/tx/detail/VaultWithdraw.cpp +++ b/src/libxrpl/tx/transactors/Vault/VaultWithdraw.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/tx/detail/XChainBridge.cpp b/src/libxrpl/tx/transactors/XChainBridge.cpp similarity index 99% rename from src/xrpld/app/tx/detail/XChainBridge.cpp rename to src/libxrpl/tx/transactors/XChainBridge.cpp index f4abb9145b..25b0e000db 100644 --- a/src/xrpld/app/tx/detail/XChainBridge.cpp +++ b/src/libxrpl/tx/transactors/XChainBridge.cpp @@ -1,8 +1,3 @@ -#include -#include -#include -#include - #include #include #include @@ -23,6 +18,10 @@ #include #include #include +#include +#include +#include +#include #include #include diff --git a/src/test/app/AMMCalc_test.cpp b/src/test/app/AMMCalc_test.cpp index bc50f02d3d..87a73689dc 100644 --- a/src/test/app/AMMCalc_test.cpp +++ b/src/test/app/AMMCalc_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include #include diff --git a/src/test/app/AMMClawback_test.cpp b/src/test/app/AMMClawback_test.cpp index 65cf7f0a60..bea57c139d 100644 --- a/src/test/app/AMMClawback_test.cpp +++ b/src/test/app/AMMClawback_test.cpp @@ -2,9 +2,8 @@ #include #include -#include - #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/AMMExtended_test.cpp b/src/test/app/AMMExtended_test.cpp index 4eecb05905..421a278fd2 100644 --- a/src/test/app/AMMExtended_test.cpp +++ b/src/test/app/AMMExtended_test.cpp @@ -5,15 +5,15 @@ #include #include -#include -#include #include -#include -#include #include #include #include +#include +#include +#include +#include #include #include diff --git a/src/test/app/AMM_test.cpp b/src/test/app/AMM_test.cpp index 8a60e5f667..bd6a405750 100644 --- a/src/test/app/AMM_test.cpp +++ b/src/test/app/AMM_test.cpp @@ -6,15 +6,14 @@ #include #include -#include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include #include @@ -955,13 +954,17 @@ private: // Equal deposit limit, tokens rounded to 0 testAMM( [&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .asset1In = STAmount{USD, 1, -15}, .asset2In = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .asset1In = STAmount{USD, 1, -15}, + .asset2In = XRPAmount{1}, + .err = ter(tecAMM_INVALID_TOKENS)}); }, {.pool = {{USD(1'000'000), XRP(1'000'000)}}, .features = {features - fixAMMv1_3}}); testAMM([&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .asset1In = STAmount{USD, 1, -15}, .asset2In = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .asset1In = STAmount{USD, 1, -15}, .asset2In = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); }); // Single deposit by asset, tokens rounded to 0 @@ -971,14 +974,18 @@ private: // Single deposit by tokens, tokens rounded to 0 testAMM([&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .tokens = IOUAmount{1, -10}, .asset1In = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .tokens = IOUAmount{1, -10}, .asset1In = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); }); // Single deposit with EPrice, tokens rounded to 0 testAMM([&](AMM& amm, Env& env) { - amm.deposit(DepositArg{ - .asset1In = STAmount{USD, 1, -15}, .maxEP = STAmount{USD, 1, -1}, .err = ter(tecAMM_INVALID_TOKENS)}); + amm.deposit( + DepositArg{ + .asset1In = STAmount{USD, 1, -15}, + .maxEP = STAmount{USD, 1, -1}, + .err = ter(tecAMM_INVALID_TOKENS)}); }); } @@ -1556,10 +1563,14 @@ private: ammAlice.withdraw(carol, std::nullopt, STAmount{USD, 1, -9}, std::nullopt, ter(tecAMM_INVALID_TOKENS)); ammAlice.withdraw(carol, std::nullopt, XRPAmount{1}, std::nullopt, ter(tecAMM_INVALID_TOKENS)); ammAlice.withdraw(WithdrawArg{.tokens = IOUAmount{1, -10}, .err = ter(tecAMM_INVALID_TOKENS)}); - ammAlice.withdraw(WithdrawArg{ - .asset1Out = STAmount{USD, 1, -15}, .asset2Out = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); - ammAlice.withdraw(WithdrawArg{ - .tokens = IOUAmount{1, -10}, .asset1Out = STAmount{USD, 1, -15}, .err = ter(tecAMM_INVALID_TOKENS)}); + ammAlice.withdraw( + WithdrawArg{ + .asset1Out = STAmount{USD, 1, -15}, .asset2Out = XRPAmount{1}, .err = ter(tecAMM_INVALID_TOKENS)}); + ammAlice.withdraw( + WithdrawArg{ + .tokens = IOUAmount{1, -10}, + .asset1Out = STAmount{USD, 1, -15}, + .err = ter(tecAMM_INVALID_TOKENS)}); }); } @@ -6150,11 +6161,12 @@ private: // tfTwoAsset withdraw mode testAMM( [&](AMM& ammAlice, Env& env) { - ammAlice.withdraw(WithdrawArg{ - .account = alice, - .asset1Out = STAmount{GBP, 3'500}, - .asset2Out = STAmount{EUR, 15'000}, - .flags = tfTwoAsset}); + ammAlice.withdraw( + WithdrawArg{ + .account = alice, + .asset1Out = STAmount{GBP, 3'500}, + .asset2Out = STAmount{EUR, 15'000}, + .flags = tfTwoAsset}); invariant(ammAlice, env, "with3", false); }, {{GBP(7'000), EUR(30'000)}}, @@ -6198,8 +6210,12 @@ private: // tfOneAssetLPToken mode testAMM( [&](AMM& ammAlice, Env& env) { - ammAlice.withdraw(WithdrawArg{ - .account = alice, .tokens = 1'000, .asset1Out = STAmount{GBP, 100}, .flags = tfOneAssetLPToken}); + ammAlice.withdraw( + WithdrawArg{ + .account = alice, + .tokens = 1'000, + .asset1Out = STAmount{GBP, 100}, + .flags = tfOneAssetLPToken}); invariant(ammAlice, env, "with6", false); }, {{GBP(7'000), EUR(30'000)}}, @@ -6210,8 +6226,12 @@ private: // tfLimitLPToken mode testAMM( [&](AMM& ammAlice, Env& env) { - ammAlice.withdraw(WithdrawArg{ - .account = alice, .asset1Out = STAmount{GBP, 100}, .maxEP = IOUAmount{2}, .flags = tfLimitLPToken}); + ammAlice.withdraw( + WithdrawArg{ + .account = alice, + .asset1Out = STAmount{GBP, 100}, + .maxEP = IOUAmount{2}, + .flags = tfLimitLPToken}); invariant(ammAlice, env, "with7", true); }, {{GBP(7'000), EUR(30'000)}}, diff --git a/src/test/app/AmendmentTable_test.cpp b/src/test/app/AmendmentTable_test.cpp index 1e4b096927..1c2cba15cc 100644 --- a/src/test/app/AmendmentTable_test.cpp +++ b/src/test/app/AmendmentTable_test.cpp @@ -1,13 +1,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/test/app/Batch_test.cpp b/src/test/app/Batch_test.cpp index a4e00f26db..3df9ba5a5a 100644 --- a/src/test/app/Batch_test.cpp +++ b/src/test/app/Batch_test.cpp @@ -3,8 +3,6 @@ #include #include -#include -#include #include #include @@ -14,6 +12,8 @@ #include #include #include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/app/EscrowToken_test.cpp b/src/test/app/EscrowToken_test.cpp index 1f3b3bab70..86f8f13d90 100644 --- a/src/test/app/EscrowToken_test.cpp +++ b/src/test/app/EscrowToken_test.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include @@ -9,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/src/test/app/Escrow_test.cpp b/src/test/app/Escrow_test.cpp index 652049270f..23c123409c 100644 --- a/src/test/app/Escrow_test.cpp +++ b/src/test/app/Escrow_test.cpp @@ -1,12 +1,11 @@ #include -#include - #include #include #include #include #include +#include #include #include diff --git a/src/test/app/FeeVote_test.cpp b/src/test/app/FeeVote_test.cpp index 15dd385d65..177c2a0bbe 100644 --- a/src/test/app/FeeVote_test.cpp +++ b/src/test/app/FeeVote_test.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/FixNFTokenPageLinks_test.cpp b/src/test/app/FixNFTokenPageLinks_test.cpp index 88f368e9cf..c64fdaaced 100644 --- a/src/test/app/FixNFTokenPageLinks_test.cpp +++ b/src/test/app/FixNFTokenPageLinks_test.cpp @@ -1,10 +1,9 @@ #include -#include -#include - #include #include +#include +#include namespace xrpl { diff --git a/src/test/app/Flow_test.cpp b/src/test/app/Flow_test.cpp index 551bd117d8..fb60cd20ad 100644 --- a/src/test/app/Flow_test.cpp +++ b/src/test/app/Flow_test.cpp @@ -1,14 +1,14 @@ #include #include -#include -#include #include #include #include #include #include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/app/Invariants_test.cpp b/src/test/app/Invariants_test.cpp index 7558c951b0..d602d42883 100644 --- a/src/test/app/Invariants_test.cpp +++ b/src/test/app/Invariants_test.cpp @@ -2,9 +2,6 @@ #include #include -#include -#include - #include #include #include @@ -17,6 +14,8 @@ #include #include #include +#include +#include #include diff --git a/src/test/app/LedgerHistory_test.cpp b/src/test/app/LedgerHistory_test.cpp index eeca551f35..ddd9ebfdb4 100644 --- a/src/test/app/LedgerHistory_test.cpp +++ b/src/test/app/LedgerHistory_test.cpp @@ -3,11 +3,11 @@ #include #include -#include #include #include #include +#include #include #include diff --git a/src/test/app/LedgerMaster_test.cpp b/src/test/app/LedgerMaster_test.cpp index eb346288c2..50a8a2ed02 100644 --- a/src/test/app/LedgerMaster_test.cpp +++ b/src/test/app/LedgerMaster_test.cpp @@ -79,8 +79,9 @@ class LedgerMaster_test : public beast::unit_test::suite auto result = env.app().getLedgerMaster().txnIdFromIndex(startLegSeq, txnIndex); BEAST_EXPECT( *result == - uint256("277F4FD89C20B92457FEF05FF63F6405563AD0563C73D967A29727" - "72679ADC65")); + uint256( + "277F4FD89C20B92457FEF05FF63F6405563AD0563C73D967A29727" + "72679ADC65")); } // success (second tx) { @@ -88,8 +89,9 @@ class LedgerMaster_test : public beast::unit_test::suite auto result = env.app().getLedgerMaster().txnIdFromIndex(startLegSeq + 1, txnIndex); BEAST_EXPECT( *result == - uint256("293DF7335EBBAF4420D52E70ABF470EB4C5792CAEA2F91F76193C2" - "819F538FDE")); + uint256( + "293DF7335EBBAF4420D52E70ABF470EB4C5792CAEA2F91F76193C2" + "819F538FDE")); } } diff --git a/src/test/app/LendingHelpers_test.cpp b/src/test/app/LendingHelpers_test.cpp index 58e4c5aaa4..e06d8ccbd1 100644 --- a/src/test/app/LendingHelpers_test.cpp +++ b/src/test/app/LendingHelpers_test.cpp @@ -5,13 +5,12 @@ #include #include -#include -#include -#include -#include - #include #include +#include +#include +#include +#include #include #include diff --git a/src/test/app/LoadFeeTrack_test.cpp b/src/test/app/LoadFeeTrack_test.cpp index 61174fc9e9..fed76288ef 100644 --- a/src/test/app/LoadFeeTrack_test.cpp +++ b/src/test/app/LoadFeeTrack_test.cpp @@ -1,8 +1,8 @@ -#include #include #include #include +#include namespace xrpl { diff --git a/src/test/app/LoanBroker_test.cpp b/src/test/app/LoanBroker_test.cpp index 58052e3fb1..b480e9535a 100644 --- a/src/test/app/LoanBroker_test.cpp +++ b/src/test/app/LoanBroker_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/Loan_test.cpp b/src/test/app/Loan_test.cpp index 5deb1f179c..86ae41a2f3 100644 --- a/src/test/app/Loan_test.cpp +++ b/src/test/app/Loan_test.cpp @@ -3,14 +3,12 @@ #include #include -#include -#include -#include -#include - #include #include -// cspell: words LOANTODO +#include +#include +#include +#include #include diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index 5b7e34ad5b..5adb677152 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -250,11 +250,12 @@ public: if (inManifests.size() == loadedManifests.size()) { - BEAST_EXPECT(std::equal( - inManifests.begin(), - inManifests.end(), - loadedManifests.begin(), - [](Manifest const* lhs, Manifest const* rhs) { return *lhs == *rhs; })); + BEAST_EXPECT( + std::equal( + inManifests.begin(), + inManifests.end(), + loadedManifests.begin(), + [](Manifest const* lhs, Manifest const* rhs) { return *lhs == *rhs; })); } else { diff --git a/src/test/app/NFTokenAuth_test.cpp b/src/test/app/NFTokenAuth_test.cpp index 1e7afc9bb0..899aea7cd5 100644 --- a/src/test/app/NFTokenAuth_test.cpp +++ b/src/test/app/NFTokenAuth_test.cpp @@ -1,6 +1,6 @@ #include -#include +#include namespace xrpl { diff --git a/src/test/app/NFTokenBurn_test.cpp b/src/test/app/NFTokenBurn_test.cpp index 915bb6ec79..7d6d07936d 100644 --- a/src/test/app/NFTokenBurn_test.cpp +++ b/src/test/app/NFTokenBurn_test.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include #include diff --git a/src/test/app/NFTokenDir_test.cpp b/src/test/app/NFTokenDir_test.cpp index 65bd97ec32..d6e2dab430 100644 --- a/src/test/app/NFTokenDir_test.cpp +++ b/src/test/app/NFTokenDir_test.cpp @@ -1,10 +1,9 @@ #include -#include - #include #include #include +#include #include diff --git a/src/test/app/NFToken_test.cpp b/src/test/app/NFToken_test.cpp index 1b9ce82d4a..7efbfbbd4c 100644 --- a/src/test/app/NFToken_test.cpp +++ b/src/test/app/NFToken_test.cpp @@ -1,10 +1,9 @@ #include -#include - #include #include #include +#include #include diff --git a/src/test/app/NetworkID_test.cpp b/src/test/app/NetworkID_test.cpp index 5fddc8f641..6b306f63fb 100644 --- a/src/test/app/NetworkID_test.cpp +++ b/src/test/app/NetworkID_test.cpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace xrpl { @@ -58,7 +59,7 @@ public: // test mainnet { test::jtx::Env env{*this, makeNetworkConfig(0)}; - BEAST_EXPECT(env.app().config().NETWORK_ID == 0); + BEAST_EXPECT(env.app().getNetworkIDService().getNetworkID() == 0); // try to submit a txn without network id, this should work Json::Value jv; @@ -81,7 +82,7 @@ public: // NetworkID { test::jtx::Env env{*this, makeNetworkConfig(1024)}; - BEAST_EXPECT(env.app().config().NETWORK_ID == 1024); + BEAST_EXPECT(env.app().getNetworkIDService().getNetworkID() == 1024); // try to submit a txn without network id, this should work Json::Value jv; @@ -101,7 +102,7 @@ public: // absent networkid { test::jtx::Env env{*this, makeNetworkConfig(1025)}; - BEAST_EXPECT(env.app().config().NETWORK_ID == 1025); + BEAST_EXPECT(env.app().getNetworkIDService().getNetworkID() == 1025); { env.fund(XRP(200), alice); // try to submit a txn without network id, this should not work diff --git a/src/test/app/OfferStream_test.cpp b/src/test/app/OfferStream_test.cpp index 218653a5d4..becb190513 100644 --- a/src/test/app/OfferStream_test.cpp +++ b/src/test/app/OfferStream_test.cpp @@ -1,6 +1,5 @@ -#include - #include +#include namespace xrpl { diff --git a/src/test/app/Oracle_test.cpp b/src/test/app/Oracle_test.cpp index 66a8969164..d3bf8a885a 100644 --- a/src/test/app/Oracle_test.cpp +++ b/src/test/app/Oracle_test.cpp @@ -47,17 +47,18 @@ private: env.fund(env.current()->fees().accountReserve(1) + env.current()->fees().base * 2, owner); Oracle oracle(env, {.owner = owner, .fee = static_cast(env.current()->fees().base.drops())}); BEAST_EXPECT(oracle.exists()); - oracle.set(UpdateArg{ - .series = - { - {"XRP", "EUR", 740, 1}, - {"XRP", "GBP", 740, 1}, - {"XRP", "CNY", 740, 1}, - {"XRP", "CAD", 740, 1}, - {"XRP", "AUD", 740, 1}, - }, - .fee = static_cast(env.current()->fees().base.drops()), - .err = ter(tecINSUFFICIENT_RESERVE)}); + oracle.set( + UpdateArg{ + .series = + { + {"XRP", "EUR", 740, 1}, + {"XRP", "GBP", 740, 1}, + {"XRP", "CNY", 740, 1}, + {"XRP", "CAD", 740, 1}, + {"XRP", "AUD", 740, 1}, + }, + .fee = static_cast(env.current()->fees().base.drops()), + .err = ter(tecINSUFFICIENT_RESERVE)}); } { @@ -70,42 +71,49 @@ private: oracle.set(CreateArg{.flags = tfSellNFToken, .fee = baseFee, .err = ter(temINVALID_FLAG)}); // Duplicate token pair - oracle.set(CreateArg{ - .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", 750, 1}}, .fee = baseFee, .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", 750, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Price is not included - oracle.set(CreateArg{ - .series = {{"XRP", "USD", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "USD", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Token pair is in update and delete - oracle.set(CreateArg{ - .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", std::nullopt, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "USD", 740, 1}, {"XRP", "USD", std::nullopt, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Token pair is in add and delete - oracle.set(CreateArg{ - .series = {{"XRP", "EUR", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .series = {{"XRP", "EUR", 740, 1}, {"XRP", "EUR", std::nullopt, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Array of token pair is 0 or exceeds 10 - oracle.set(CreateArg{ - .series = - {{"XRP", "US1", 740, 1}, - {"XRP", "US2", 750, 1}, - {"XRP", "US3", 740, 1}, - {"XRP", "US4", 750, 1}, - {"XRP", "US5", 740, 1}, - {"XRP", "US6", 750, 1}, - {"XRP", "US7", 740, 1}, - {"XRP", "US8", 750, 1}, - {"XRP", "US9", 740, 1}, - {"XRP", "U10", 750, 1}, - {"XRP", "U11", 740, 1}}, - .fee = baseFee, - .err = ter(temARRAY_TOO_LARGE)}); + oracle.set( + CreateArg{ + .series = + {{"XRP", "US1", 740, 1}, + {"XRP", "US2", 750, 1}, + {"XRP", "US3", 740, 1}, + {"XRP", "US4", 750, 1}, + {"XRP", "US5", 740, 1}, + {"XRP", "US6", 750, 1}, + {"XRP", "US7", 740, 1}, + {"XRP", "US8", 750, 1}, + {"XRP", "US9", 740, 1}, + {"XRP", "U10", 750, 1}, + {"XRP", "U11", 740, 1}}, + .fee = baseFee, + .err = ter(temARRAY_TOO_LARGE)}); oracle.set(CreateArg{.series = {}, .fee = baseFee, .err = ter(temARRAY_EMPTY)}); } @@ -116,22 +124,23 @@ private: env.fund(XRP(1'000), owner); Oracle oracle(env, CreateArg{.owner = owner, .series = {{{"XRP", "USD", 740, 1}}}, .fee = baseFee}); - oracle.set(UpdateArg{ - .series = - { - {"XRP", "US1", 740, 1}, - {"XRP", "US2", 750, 1}, - {"XRP", "US3", 740, 1}, - {"XRP", "US4", 750, 1}, - {"XRP", "US5", 740, 1}, - {"XRP", "US6", 750, 1}, - {"XRP", "US7", 740, 1}, - {"XRP", "US8", 750, 1}, - {"XRP", "US9", 740, 1}, - {"XRP", "U10", 750, 1}, - }, - .fee = baseFee, - .err = ter(tecARRAY_TOO_LARGE)}); + oracle.set( + UpdateArg{ + .series = + { + {"XRP", "US1", 740, 1}, + {"XRP", "US2", 750, 1}, + {"XRP", "US3", 740, 1}, + {"XRP", "US4", 750, 1}, + {"XRP", "US5", 740, 1}, + {"XRP", "US6", 750, 1}, + {"XRP", "US7", 740, 1}, + {"XRP", "US8", 750, 1}, + {"XRP", "US9", 740, 1}, + {"XRP", "U10", 750, 1}, + }, + .fee = baseFee, + .err = ter(tecARRAY_TOO_LARGE)}); } { @@ -141,26 +150,33 @@ private: Oracle oracle(env, {.owner = owner, .fee = baseFee}, false); // Asset class or provider not included on create - oracle.set(CreateArg{ - .assetClass = std::nullopt, .provider = "provider", .fee = baseFee, .err = ter(temMALFORMED)}); - oracle.set(CreateArg{ - .assetClass = "currency", - .provider = std::nullopt, - .uri = "URI", - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .assetClass = std::nullopt, .provider = "provider", .fee = baseFee, .err = ter(temMALFORMED)}); + oracle.set( + CreateArg{ + .assetClass = "currency", + .provider = std::nullopt, + .uri = "URI", + .fee = baseFee, + .err = ter(temMALFORMED)}); // Asset class or provider are included on update // and don't match the current values oracle.set(CreateArg{.fee = static_cast(env.current()->fees().base.drops())}); BEAST_EXPECT(oracle.exists()); - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, .provider = "provider1", .fee = baseFee, .err = ter(temMALFORMED)}); - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .assetClass = "currency1", - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .provider = "provider1", + .fee = baseFee, + .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .assetClass = "currency1", + .fee = baseFee, + .err = ter(temMALFORMED)}); } { @@ -214,31 +230,35 @@ private: BEAST_EXPECT(oracle.exists()); env.close(seconds(400)); // Less than the last close time - 300s - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(closeTime() - 301), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(closeTime() - 301), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); // Greater than last close time + 300s - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(closeTime() + 311), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(closeTime() + 311), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); oracle.set(UpdateArg{.series = {{"XRP", "USD", 740, 1}}, .fee = baseFee}); BEAST_EXPECT(oracle.expectLastUpdateTime(static_cast(testStartTime.count() + 450))); // Less than the previous lastUpdateTime - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(449), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(449), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); // Less than the epoch time - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .lastUpdateTime = static_cast(epoch_offset.count() - 1), - .fee = baseFee, - .err = ter(tecINVALID_UPDATE_TIME)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .lastUpdateTime = static_cast(epoch_offset.count() - 1), + .fee = baseFee, + .err = ter(tecINVALID_UPDATE_TIME)}); } { @@ -248,13 +268,17 @@ private: env.fund(XRP(1'000), owner); Oracle oracle(env, {.owner = owner, .fee = baseFee}); BEAST_EXPECT(oracle.exists()); - oracle.set(UpdateArg{ - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee, - .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); // delete all token pairs - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", std::nullopt, std::nullopt}}, .fee = baseFee, .err = ter(tecARRAY_EMPTY)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(tecARRAY_EMPTY)}); } { @@ -285,21 +309,24 @@ private: auto const baseFee = static_cast(env.current()->fees().base.drops()); env.fund(XRP(1'000), owner); Oracle oracle(env, {.owner = owner, .fee = baseFee}); - oracle.set(UpdateArg{ - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}, {"XRP", "EUR", 740, 1}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}, {"XRP", "EUR", 740, 1}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); // Delete token pair that doesn't exist in this oracle - oracle.set(UpdateArg{ - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee, - .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(tecTOKEN_PAIR_NOT_FOUND)}); // Delete token pair in oracle, which is not in the ledger - oracle.set(UpdateArg{ - .documentID = 10, - .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee, - .err = ter(temMALFORMED)}); + oracle.set( + UpdateArg{ + .documentID = 10, + .series = {{"XRP", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee, + .err = ter(temMALFORMED)}); } { @@ -521,28 +548,30 @@ private: BEAST_EXPECT(ownerCount(env, owner) == count); // owner count is increased by 1 since the number of pairs is 6 - oracle.set(UpdateArg{ - .series = - { - {"BTC", "USD", 741, 2}, - {"ETH", "EUR", 710, 2}, - {"YAN", "EUR", 710, 2}, - {"CAN", "EUR", 710, 2}, - }, - .fee = baseFee}); + oracle.set( + UpdateArg{ + .series = + { + {"BTC", "USD", 741, 2}, + {"ETH", "EUR", 710, 2}, + {"YAN", "EUR", 710, 2}, + {"CAN", "EUR", 710, 2}, + }, + .fee = baseFee}); count += 1; BEAST_EXPECT(ownerCount(env, owner) == count); // update two pairs and delete four oracle.set(UpdateArg{.series = {{"BTC", "USD", std::nullopt, std::nullopt}}, .fee = baseFee}); - oracle.set(UpdateArg{ - .series = - {{"XRP", "USD", 742, 2}, - {"XRP", "EUR", 711, 2}, - {"ETH", "EUR", std::nullopt, std::nullopt}, - {"YAN", "EUR", std::nullopt, std::nullopt}, - {"CAN", "EUR", std::nullopt, std::nullopt}}, - .fee = baseFee}); + oracle.set( + UpdateArg{ + .series = + {{"XRP", "USD", 742, 2}, + {"XRP", "EUR", 711, 2}, + {"ETH", "EUR", std::nullopt, std::nullopt}, + {"YAN", "EUR", std::nullopt, std::nullopt}, + {"CAN", "EUR", std::nullopt, std::nullopt}}, + .fee = baseFee}); BEAST_EXPECT(oracle.expectPrice({{"XRP", "USD", 742, 2}, {"XRP", "EUR", 711, 2}})); // owner count is decreased by 1 since the number of pairs is 2 count -= 1; @@ -638,10 +667,12 @@ private: BEAST_EXPECT(oracle.exists()); // Update - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, .msig = msig(becky), .fee = baseFee, .err = ter(tefBAD_QUORUM)}); - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, .msig = msig(zelda), .fee = baseFee, .err = ter(tefBAD_SIGNATURE)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, .msig = msig(becky), .fee = baseFee, .err = ter(tefBAD_QUORUM)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, .msig = msig(zelda), .fee = baseFee, .err = ter(tefBAD_SIGNATURE)}); oracle.set(UpdateArg{.series = {{"XRP", "USD", 741, 1}}, .msig = msig(becky, bogie), .fee = baseFee}); BEAST_EXPECT(oracle.expectPrice({{"XRP", "USD", 741, 1}})); // remove the signer list @@ -652,11 +683,12 @@ private: env(signers(alice, 2, {{zelda, 1}, {bob, 1}, {ed, 2}}), sig(alie)); env.close(); // old list fails - oracle.set(UpdateArg{ - .series = {{"XRP", "USD", 740, 1}}, - .msig = msig(becky, bogie), - .fee = baseFee, - .err = ter(tefBAD_SIGNATURE)}); + oracle.set( + UpdateArg{ + .series = {{"XRP", "USD", 740, 1}}, + .msig = msig(becky, bogie), + .fee = baseFee, + .err = ter(tefBAD_SIGNATURE)}); // updated list succeeds oracle.set(UpdateArg{.series = {{"XRP", "USD", 7412, 2}}, .msig = msig(zelda, bob), .fee = baseFee}); BEAST_EXPECT(oracle.expectPrice({{"XRP", "USD", 7412, 2}})); diff --git a/src/test/app/PayStrand_test.cpp b/src/test/app/PayStrand_test.cpp index 9b534d9284..93cc8caf47 100644 --- a/src/test/app/PayStrand_test.cpp +++ b/src/test/app/PayStrand_test.cpp @@ -1,9 +1,6 @@ #include #include -#include -#include -#include #include #include @@ -11,6 +8,9 @@ #include #include #include +#include +#include +#include #include diff --git a/src/test/app/PermissionedDEX_test.cpp b/src/test/app/PermissionedDEX_test.cpp index 7a55866780..2129d2c2c4 100644 --- a/src/test/app/PermissionedDEX_test.cpp +++ b/src/test/app/PermissionedDEX_test.cpp @@ -2,8 +2,6 @@ #include #include -#include - #include #include #include @@ -18,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/src/test/app/PermissionedDomains_test.cpp b/src/test/app/PermissionedDomains_test.cpp index 8485202144..ec969a105c 100644 --- a/src/test/app/PermissionedDomains_test.cpp +++ b/src/test/app/PermissionedDomains_test.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include #include #include diff --git a/src/test/app/PseudoTx_test.cpp b/src/test/app/PseudoTx_test.cpp index 29e13888c3..aa16df8e9c 100644 --- a/src/test/app/PseudoTx_test.cpp +++ b/src/test/app/PseudoTx_test.cpp @@ -1,8 +1,7 @@ #include -#include - #include +#include #include #include diff --git a/src/test/app/Regression_test.cpp b/src/test/app/Regression_test.cpp index 052b334ef5..a4d387dec1 100644 --- a/src/test/app/Regression_test.cpp +++ b/src/test/app/Regression_test.cpp @@ -3,13 +3,13 @@ #include #include -#include #include #include #include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/app/TheoreticalQuality_test.cpp b/src/test/app/TheoreticalQuality_test.cpp index 1f626ad477..b6b44625cc 100644 --- a/src/test/app/TheoreticalQuality_test.cpp +++ b/src/test/app/TheoreticalQuality_test.cpp @@ -1,16 +1,15 @@ #include #include -#include -#include -#include -#include - #include #include #include #include #include +#include +#include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index a97a650ede..fe6024c79b 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -6,13 +6,13 @@ #include #include -#include #include -#include #include #include #include +#include +#include namespace xrpl { diff --git a/src/test/app/Vault_test.cpp b/src/test/app/Vault_test.cpp index 5d31c674c0..cf86ab6033 100644 --- a/src/test/app/Vault_test.cpp +++ b/src/test/app/Vault_test.cpp @@ -969,13 +969,14 @@ class Vault_test : public beast::unit_test::suite { using namespace test::jtx; - auto testCase = [this](std::function test) { + auto testCase = [this]( + std::function test) { Env env{*this, testable_amendments() | featureSingleAssetVault}; Account issuer{"issuer"}; Account owner{"owner"}; @@ -1255,13 +1256,14 @@ class Vault_test : public beast::unit_test::suite { using namespace test::jtx; - auto testCase = [this](std::function test) { + auto testCase = [this]( + std::function test) { Env env{*this, testable_amendments() | featureSingleAssetVault}; Account issuer{"issuer"}; Account owner{"owner"}; diff --git a/src/test/app/tx/apply_test.cpp b/src/test/app/tx/apply_test.cpp index fada168112..44074baf03 100644 --- a/src/test/app/tx/apply_test.cpp +++ b/src/test/app/tx/apply_test.cpp @@ -2,10 +2,9 @@ #include -#include - #include #include +#include namespace xrpl { @@ -38,12 +37,8 @@ public: { test::jtx::Env fully_canonical(*this, test::jtx::testable_amendments()); - Validity valid = checkValidity( - fully_canonical.app().getHashRouter(), - tx, - fully_canonical.current()->rules(), - fully_canonical.app().config()) - .first; + Validity valid = + checkValidity(fully_canonical.app().getHashRouter(), tx, fully_canonical.current()->rules()).first; if (valid == Validity::Valid) fail("Non-Fully canonical signature was permitted"); } diff --git a/src/test/beast/IPEndpoint_test.cpp b/src/test/beast/IPEndpoint_test.cpp index 67e3f8ed7d..7ce5271383 100644 --- a/src/test/beast/IPEndpoint_test.cpp +++ b/src/test/beast/IPEndpoint_test.cpp @@ -334,9 +334,9 @@ public: #if BOOST_OS_WINDOWS // windows asio bugs...false positives - shouldParseEPV4("255", {{ 0, 0, 0, 255 }}, 0, "0.0.0.255"); - shouldParseEPV4("512", {{ 0, 0, 2, 0 }}, 0, "0.0.2.0"); - shouldParseEPV4("1.2.3:80", {{ 1, 2, 0, 3 }}, 80, "1.2.0.3:80"); + shouldParseEPV4("255", {{0, 0, 0, 255}}, 0, "0.0.0.255"); + shouldParseEPV4("512", {{0, 0, 2, 0}}, 0, "0.0.2.0"); + shouldParseEPV4("1.2.3:80", {{1, 2, 0, 3}}, 80, "1.2.0.3:80"); #else failParseEP("255"); failParseEP("512"); diff --git a/src/test/consensus/NegativeUNL_test.cpp b/src/test/consensus/NegativeUNL_test.cpp index 9e77f158a3..b8599744bf 100644 --- a/src/test/consensus/NegativeUNL_test.cpp +++ b/src/test/consensus/NegativeUNL_test.cpp @@ -4,10 +4,10 @@ #include #include #include -#include #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/core/Config_test.cpp b/src/test/core/Config_test.cpp index d5f3bb556c..2e7fc8635f 100644 --- a/src/test/core/Config_test.cpp +++ b/src/test/core/Config_test.cpp @@ -1116,23 +1116,24 @@ trust-these-validators.gov Config cfg; /* NOTE: this string includes some explicit * space chars in order to verify proper trimming */ - std::string toLoad(R"( + std::string toLoad( + R"( [port_rpc])" - "\x20" - R"( + "\x20" + R"( # comment # indented comment )" - "\x20\x20" - R"( + "\x20\x20" + R"( [ips])" - "\x20" - R"( + "\x20" + R"( r.ripple.com 51235 [ips_fixed])" - "\x20\x20" - R"( + "\x20\x20" + R"( # COMMENT s1.ripple.com 51235 s2.ripple.com 51235 @@ -1156,23 +1157,24 @@ r.ripple.com 51235 Config cfg; /* NOTE: this string includes some explicit * space chars in order to verify proper trimming */ - std::string toLoad(R"( + std::string toLoad( + R"( [port_rpc])" - "\x20" - R"( + "\x20" + R"( # comment # indented comment )" - "\x20\x20" - R"( + "\x20\x20" + R"( [ips])" - "\x20" - R"( + "\x20" + R"( r.ripple.com:51235 [ips_fixed])" - "\x20\x20" - R"( + "\x20\x20" + R"( # COMMENT s1.ripple.com:51235 s2.ripple.com 51235 diff --git a/src/test/jtx/impl/AMM.cpp b/src/test/jtx/impl/AMM.cpp index f920858ea5..9049b5400c 100644 --- a/src/test/jtx/impl/AMM.cpp +++ b/src/test/jtx/impl/AMM.cpp @@ -1,13 +1,12 @@ #include #include -#include -#include - #include #include #include #include +#include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/impl/Env.cpp b/src/test/jtx/impl/Env.cpp index 3fdfa2bf2a..636894c0d5 100644 --- a/src/test/jtx/impl/Env.cpp +++ b/src/test/jtx/impl/Env.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -526,7 +527,7 @@ Env::autofill(JTx& jt) if (jt.fill_netid) { - uint32_t networkID = app().config().NETWORK_ID; + uint32_t networkID = app().getNetworkIDService().getNetworkID(); if (!jv.isMember(jss::NetworkID) && networkID > 1024) jv[jss::NetworkID] = std::to_string(networkID); } diff --git a/src/test/jtx/impl/amount.cpp b/src/test/jtx/impl/amount.cpp index 73dad7f48e..258b948967 100644 --- a/src/test/jtx/impl/amount.cpp +++ b/src/test/jtx/impl/amount.cpp @@ -28,7 +28,8 @@ operator<<(std::ostream&& os, } #endif -PrettyAmount::operator AnyAmount() const +PrettyAmount:: +operator AnyAmount() const { return {amount_}; } diff --git a/src/test/jtx/impl/ledgerStateFixes.cpp b/src/test/jtx/impl/ledgerStateFixes.cpp index f1e6b6eda1..04860a5e3a 100644 --- a/src/test/jtx/impl/ledgerStateFixes.cpp +++ b/src/test/jtx/impl/ledgerStateFixes.cpp @@ -1,9 +1,8 @@ #include -#include - #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/jtx/impl/mpt.cpp b/src/test/jtx/impl/mpt.cpp index f505bff740..c934d21ff5 100644 --- a/src/test/jtx/impl/mpt.cpp +++ b/src/test/jtx/impl/mpt.cpp @@ -91,7 +91,8 @@ MPTTester::MPTTester(MPTInitDef const& arg) { } -MPTTester::operator MPT() const +MPTTester:: +operator MPT() const { if (!id_) Throw("MPT has not been created"); @@ -534,7 +535,8 @@ MPTTester::mpt(std::int64_t amount) const return xrpl::test::jtx::MPT(issuer_.name(), *id_)(amount); } -MPTTester::operator Asset() const +MPTTester:: +operator Asset() const { if (!id_) Throw("MPT has not been created"); diff --git a/src/test/jtx/impl/token.cpp b/src/test/jtx/impl/token.cpp index 172bd75bc7..613e0710d4 100644 --- a/src/test/jtx/impl/token.cpp +++ b/src/test/jtx/impl/token.cpp @@ -1,10 +1,9 @@ #include #include -#include - #include #include +#include namespace xrpl { namespace test { diff --git a/src/test/overlay/compression_test.cpp b/src/test/overlay/compression_test.cpp index 19876809d2..a5fbef69cf 100644 --- a/src/test/overlay/compression_test.cpp +++ b/src/test/overlay/compression_test.cpp @@ -108,8 +108,9 @@ public: BEAST_EXPECT(proto1->ParseFromArray(decompressed.data(), decompressedSize)); auto uncompressed = m.getBuffer(Compressed::Off); - BEAST_EXPECT(std::equal( - uncompressed.begin() + xrpl::compression::headerBytes, uncompressed.end(), decompressed.begin())); + BEAST_EXPECT( + std::equal( + uncompressed.begin() + xrpl::compression::headerBytes, uncompressed.end(), decompressed.begin())); } std::shared_ptr diff --git a/src/test/protocol/STParsedJSON_test.cpp b/src/test/protocol/STParsedJSON_test.cpp index 0ef7878cdc..5b8be83499 100644 --- a/src/test/protocol/STParsedJSON_test.cpp +++ b/src/test/protocol/STParsedJSON_test.cpp @@ -2003,8 +2003,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"tecFROZEN"})"); + std::string const goodJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"tecFROZEN"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2019,10 +2020,12 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":19,"Method":"250",)" - R"("TransactionResult":"tecFROZEN"})"); - std::string const expectedJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"tecFROZEN"})"); + std::string const goodJson( + R"({"CloseResolution":19,"Method":"250",)" + R"("TransactionResult":"tecFROZEN"})"); + std::string const expectedJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"tecFROZEN"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2040,10 +2043,12 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":"19","Method":"250",)" - R"("TransactionResult":"tecFROZEN"})"); - std::string const expectedJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"tecFROZEN"})"); + std::string const goodJson( + R"({"CloseResolution":"19","Method":"250",)" + R"("TransactionResult":"tecFROZEN"})"); + std::string const expectedJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"tecFROZEN"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2061,8 +2066,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransactionResult":"terQUEUED"})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransactionResult":"terQUEUED"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2076,8 +2082,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":"pony",)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":19,"Method":"pony",)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2091,8 +2098,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":3294967296,)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":19,"Method":3294967296,)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2106,8 +2114,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":-10,"Method":42,)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":-10,"Method":42,)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2121,8 +2130,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":3.141592653,)" - R"("TransactionResult":"tesSUCCESS"})"); + std::string const json( + R"({"CloseResolution":19,"Method":3.141592653,)" + R"("TransactionResult":"tesSUCCESS"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2136,10 +2146,12 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const goodJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":"65535"})"); - std::string const expectedJson(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":65535})"); + std::string const goodJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":"65535"})"); + std::string const expectedJson( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":65535})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(goodJson, jv))) @@ -2154,8 +2166,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":"65536"})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":"65536"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2169,8 +2182,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":"Payment"})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":"Payment"})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) @@ -2184,8 +2198,9 @@ class STParsedJSON_test : public beast::unit_test::suite } { - std::string const json(R"({"CloseResolution":19,"Method":250,)" - R"("TransferFee":true})"); + std::string const json( + R"({"CloseResolution":19,"Method":250,)" + R"("TransferFee":true})"); Json::Value jv; if (BEAST_EXPECT(parseJSONString(json, jv))) diff --git a/src/test/rpc/AccountObjects_test.cpp b/src/test/rpc/AccountObjects_test.cpp index 0dec2bde7f..664e96bbef 100644 --- a/src/test/rpc/AccountObjects_test.cpp +++ b/src/test/rpc/AccountObjects_test.cpp @@ -2,13 +2,12 @@ #include #include -#include - #include #include #include #include #include +#include #include @@ -769,8 +768,9 @@ public: // xchain_create_account_claim_id should be present on the door // account (Account::master) to collect the signatures until a // quorum is reached - scEnv(test::jtx::create_account_attestation( - x.scAttester, x.jvb, x.mcCarol, amt, x.reward, x.payees[0], true, 1, x.scuAlice, x.signers[0])); + scEnv( + test::jtx::create_account_attestation( + x.scAttester, x.jvb, x.mcCarol, amt, x.reward, x.payees[0], true, 1, x.scuAlice, x.signers[0])); scEnv.close(); auto scEnvAcctObjs = [&](Account const& acct, char const* type) { diff --git a/src/test/rpc/AccountSet_test.cpp b/src/test/rpc/AccountSet_test.cpp index 2e238773f9..03fe4e3ede 100644 --- a/src/test/rpc/AccountSet_test.cpp +++ b/src/test/rpc/AccountSet_test.cpp @@ -1,12 +1,11 @@ #include -#include - #include #include #include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/Feature_test.cpp b/src/test/rpc/Feature_test.cpp index 21596634e3..c9afb38d3b 100644 --- a/src/test/rpc/Feature_test.cpp +++ b/src/test/rpc/Feature_test.cpp @@ -1,7 +1,6 @@ #include -#include - +#include #include #include @@ -162,9 +161,9 @@ class Feature_test : public beast::unit_test::suite BEAST_EXPECTS(jrr[jss::status] == jss::success, "status"); jrr.removeMember(jss::status); BEAST_EXPECT(jrr.size() == 1); - BEAST_EXPECT( - jrr.isMember("12523DF04B553A0B1AD74F42DDB741DE8DC06A03FC089A0EF197E" - "2A87F1D8107")); + BEAST_EXPECT(jrr.isMember( + "12523DF04B553A0B1AD74F42DDB741DE8DC06A03FC089A0EF197E" + "2A87F1D8107")); auto feature = *(jrr.begin()); BEAST_EXPECTS(feature[jss::name] == "fixAMMOverflowOffer", "name"); diff --git a/src/test/rpc/GRPCTestClientBase.h b/src/test/rpc/GRPCTestClientBase.h index 3c39cd1747..475c9da43b 100644 --- a/src/test/rpc/GRPCTestClientBase.h +++ b/src/test/rpc/GRPCTestClientBase.h @@ -12,9 +12,12 @@ namespace test { struct GRPCTestClientBase { explicit GRPCTestClientBase(std::string const& port) - : stub_(org::xrpl::rpc::v1::XRPLedgerAPIService::NewStub(grpc::CreateChannel( - beast::IP::Endpoint(boost::asio::ip::make_address(getEnvLocalhostAddr()), std::stoi(port)).to_string(), - grpc::InsecureChannelCredentials()))) + : stub_( + org::xrpl::rpc::v1::XRPLedgerAPIService::NewStub( + grpc::CreateChannel( + beast::IP::Endpoint(boost::asio::ip::make_address(getEnvLocalhostAddr()), std::stoi(port)) + .to_string(), + grpc::InsecureChannelCredentials()))) { } diff --git a/src/test/rpc/JSONRPC_test.cpp b/src/test/rpc/JSONRPC_test.cpp index f0329748e1..b82719261b 100644 --- a/src/test/rpc/JSONRPC_test.cpp +++ b/src/test/rpc/JSONRPC_test.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/test/rpc/LedgerEntry_test.cpp b/src/test/rpc/LedgerEntry_test.cpp index 5d12e7bb83..68b869cbfc 100644 --- a/src/test/rpc/LedgerEntry_test.cpp +++ b/src/test/rpc/LedgerEntry_test.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include #include @@ -15,6 +13,7 @@ #include #include + namespace xrpl { namespace test { @@ -581,17 +580,21 @@ class LedgerEntry_test : public beast::unit_test::suite // Create Amendments vector (enabled amendments) std::vector enabledAmendments; enabledAmendments.push_back( - uint256::fromVoid("42426C4D4F1009EE67080A9B7965B44656D7" - "714D104A72F9B4369F97ABF044EE")); + uint256::fromVoid( + "42426C4D4F1009EE67080A9B7965B44656D7" + "714D104A72F9B4369F97ABF044EE")); enabledAmendments.push_back( - uint256::fromVoid("4C97EBA926031A7CF7D7B36FDE3ED66DDA54" - "21192D63DE53FFB46E43B9DC8373")); + uint256::fromVoid( + "4C97EBA926031A7CF7D7B36FDE3ED66DDA54" + "21192D63DE53FFB46E43B9DC8373")); enabledAmendments.push_back( - uint256::fromVoid("03BDC0099C4E14163ADA272C1B6F6FABB448" - "CC3E51F522F978041E4B57D9158C")); + uint256::fromVoid( + "03BDC0099C4E14163ADA272C1B6F6FABB448" + "CC3E51F522F978041E4B57D9158C")); enabledAmendments.push_back( - uint256::fromVoid("35291ADD2D79EB6991343BDA0912269C817D" - "0F094B02226C1C14AD2858962ED4")); + uint256::fromVoid( + "35291ADD2D79EB6991343BDA0912269C817D" + "0F094B02226C1C14AD2858962ED4")); sle->setFieldV256(sfAmendments, STVector256(enabledAmendments)); // Create Majorities array @@ -600,16 +603,18 @@ class LedgerEntry_test : public beast::unit_test::suite auto majority1 = STObject::makeInnerObject(sfMajority); majority1.setFieldH256( sfAmendment, - uint256::fromVoid("7BB62DC13EC72B775091E9C71BF8CF97E122" - "647693B50C5E87A80DFD6FCFAC50")); + uint256::fromVoid( + "7BB62DC13EC72B775091E9C71BF8CF97E122" + "647693B50C5E87A80DFD6FCFAC50")); majority1.setFieldU32(sfCloseTime, 779561310); majorities.push_back(std::move(majority1)); auto majority2 = STObject::makeInnerObject(sfMajority); majority2.setFieldH256( sfAmendment, - uint256::fromVoid("755C971C29971C9F20C6F080F2ED96F87884" - "E40AD19554A5EBECDCEC8A1F77FE")); + uint256::fromVoid( + "755C971C29971C9F20C6F080F2ED96F87884" + "E40AD19554A5EBECDCEC8A1F77FE")); majority2.setFieldU32(sfCloseTime, 779561310); majorities.push_back(std::move(majority2)); @@ -1449,9 +1454,10 @@ class LedgerEntry_test : public beast::unit_test::suite sle->setFieldArray(sfDisabledValidators, disabledValidators); sle->setFieldH256( sfPreviousTxnID, - uint256::fromVoid("8D47FFE664BE6C335108DF689537625855A6" - "A95160CC6D351341B9" - "2624D9C5E3")); + uint256::fromVoid( + "8D47FFE664BE6C335108DF689537625855A6" + "A95160CC6D351341B9" + "2624D9C5E3")); sle->setFieldU32(sfPreviousTxnLgrSeq, 91442944); view.rawInsert(sle); diff --git a/src/test/rpc/Subscribe_test.cpp b/src/test/rpc/Subscribe_test.cpp index 759b02dcc7..f6c5690856 100644 --- a/src/test/rpc/Subscribe_test.cpp +++ b/src/test/rpc/Subscribe_test.cpp @@ -3,13 +3,14 @@ #include #include -#include #include #include +#include #include #include #include +#include #include #include @@ -106,7 +107,7 @@ public: BEAST_EXPECT(jv.isMember(jss::id) && jv[jss::id] == 5); } BEAST_EXPECT(jv[jss::result][jss::ledger_index] == 2); - BEAST_EXPECT(jv[jss::result][jss::network_id] == env.app().config().NETWORK_ID); + BEAST_EXPECT(jv[jss::result][jss::network_id] == env.app().getNetworkIDService().getNetworkID()); } { @@ -115,7 +116,8 @@ public: // Check stream update BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - return jv[jss::ledger_index] == 3 && jv[jss::network_id] == env.app().config().NETWORK_ID; + return jv[jss::ledger_index] == 3 && + jv[jss::network_id] == env.app().getNetworkIDService().getNetworkID(); })); } @@ -125,7 +127,8 @@ public: // Check stream update BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) { - return jv[jss::ledger_index] == 4 && jv[jss::network_id] == env.app().config().NETWORK_ID; + return jv[jss::ledger_index] == 4 && + jv[jss::network_id] == env.app().getNetworkIDService().getNetworkID(); })); } @@ -451,7 +454,7 @@ public: if (!jv.isMember(jss::validated_hash)) return false; - uint32_t netID = env.app().config().NETWORK_ID; + uint32_t netID = env.app().getNetworkIDService().getNetworkID(); if (!jv.isMember(jss::network_id) || jv[jss::network_id] != netID) return false; @@ -510,7 +513,7 @@ public: jv[jss::streams][0u] = "ledger"; jr = env.rpc("json", "subscribe", to_string(jv))[jss::result]; BEAST_EXPECT(jr[jss::status] == "success"); - BEAST_EXPECT(jr[jss::network_id] == env.app().config().NETWORK_ID); + BEAST_EXPECT(jr[jss::network_id] == env.app().getNetworkIDService().getNetworkID()); jr = env.rpc("json", "unsubscribe", to_string(jv))[jss::result]; BEAST_EXPECT(jr[jss::status] == "success"); diff --git a/src/test/rpc/Transaction_test.cpp b/src/test/rpc/Transaction_test.cpp index acc8bccf61..731caee429 100644 --- a/src/test/rpc/Transaction_test.cpp +++ b/src/test/rpc/Transaction_test.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -247,7 +248,7 @@ class Transaction_test : public beast::unit_test::suite char const* EXCESSIVE = RPC::get_error_info(rpcEXCESSIVE_LGR_RANGE).token; Env env{*this, makeNetworkConfig(11111)}; - uint32_t netID = env.app().config().NETWORK_ID; + uint32_t netID = env.app().getNetworkIDService().getNetworkID(); auto const alice = Account("alice"); env.fund(XRP(1000), alice); @@ -520,7 +521,7 @@ class Transaction_test : public beast::unit_test::suite for (uint32_t netID : {11111, 65535, 65536}) { Env env{*this, makeNetworkConfig(netID)}; - BEAST_EXPECT(netID == env.app().config().NETWORK_ID); + BEAST_EXPECT(netID == env.app().getNetworkIDService().getNetworkID()); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -550,7 +551,7 @@ class Transaction_test : public beast::unit_test::suite // test querying with mixed case ctid { Env env{*this, makeNetworkConfig(11111)}; - std::uint32_t const netID = env.app().config().NETWORK_ID; + std::uint32_t const netID = env.app().getNetworkIDService().getNetworkID(); Account const alice = Account("alice"); Account const bob = Account("bob"); @@ -591,7 +592,7 @@ class Transaction_test : public beast::unit_test::suite for (uint32_t netID : {2, 1024, 65535, 65536}) { Env env{*this, makeNetworkConfig(netID)}; - BEAST_EXPECT(netID == env.app().config().NETWORK_ID); + BEAST_EXPECT(netID == env.app().getNetworkIDService().getNetworkID()); auto const alice = Account("alice"); auto const bob = Account("bob"); @@ -623,7 +624,7 @@ class Transaction_test : public beast::unit_test::suite // test the wrong network ID was submitted { Env env{*this, makeNetworkConfig(21337)}; - uint32_t netID = env.app().config().NETWORK_ID; + uint32_t netID = env.app().getNetworkIDService().getNetworkID(); auto const alice = Account("alice"); auto const bob = Account("bob"); diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index 5a91ad4b03..d84b750c87 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -4,12 +4,12 @@ #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/test/shamap/SHAMap_test.cpp b/src/test/shamap/SHAMap_test.cpp index c91cc63749..d33a53b9b3 100644 --- a/src/test/shamap/SHAMap_test.cpp +++ b/src/test/shamap/SHAMap_test.cpp @@ -196,40 +196,56 @@ public: testcase("build/tear unbacked"); { constexpr std::array keys{ - uint256("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8")}; + uint256( + "b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8")}; constexpr std::array hashes{ - uint256("B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C" - "64B6281F7F"), - uint256("FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A883184546" - "7FB2ECE266"), - uint256("4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51A" - "E756795B75"), - uint256("7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC" - "6C74F93E07"), - uint256("395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596" - "462B0E3A3E"), - uint256("D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D9" - "8A84D9DDE4"), - uint256("76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF9" - "4361143615"), - uint256("DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA0" - "2BBE7230E5")}; + uint256( + "B7387CFEA0465759ADC718E8C42B52D2309D179B326E239EB5075C" + "64B6281F7F"), + uint256( + "FBC195A9592A54AB44010274163CB6BA95F497EC5BA0A883184546" + "7FB2ECE266"), + uint256( + "4E7D2684B65DFD48937FFB775E20175C43AF0C94066F7D5679F51A" + "E756795B75"), + uint256( + "7A2F312EB203695FFD164E038E281839EEF06A1B99BFC263F3CECC" + "6C74F93E07"), + uint256( + "395A6691A372387A703FB0F2C6D2C405DAF307D0817F8F0E207596" + "462B0E3A3E"), + uint256( + "D044C0A696DE3169CC70AE216A1564D69DE96582865796142CE7D9" + "8A84D9DDE4"), + uint256( + "76DCC77C4027309B5A91AD164083264D70B77B5E43E08AEDA5EBF9" + "4361143615"), + uint256( + "DF4220E93ADC6F5569063A01B4DC79F8DB9553B6A3222ADE23DEA0" + "2BBE7230E5")}; SHAMap map(SHAMapType::FREE, f); if (!backed) @@ -258,22 +274,30 @@ public: { constexpr std::array keys{ - uint256("f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8"), - uint256("292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" - "5a772c6ca8")}; + uint256( + "f22891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b99891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92881fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92791fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b92691fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "b91891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8"), + uint256( + "292891fe4ef6cee585fdc6fda1e09eb4d386363158ec3321b8123e" + "5a772c6ca8")}; tests::TestNodeFamily tf{journal}; SHAMap map{SHAMapType::FREE, tf}; diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index ad581585b1..3ed55a893f 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include #include @@ -21,9 +19,11 @@ #include #include #include +#include #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index d75e4dd22e..566dce4720 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -878,18 +878,12 @@ Ledger::updateSkipList() bool Ledger::isFlagLedger() const { - return header_.seq % FLAG_LEDGER_INTERVAL == 0; + return ::xrpl::isFlagLedger(header_.seq); } bool Ledger::isVotingLedger() const { - return (header_.seq + 1) % FLAG_LEDGER_INTERVAL == 0; -} - -bool -isFlagLedger(LedgerIndex seq) -{ - return seq % FLAG_LEDGER_INTERVAL == 0; + return ::xrpl::isVotingLedger(header_.seq + 1); } static bool diff --git a/src/xrpld/app/ledger/Ledger.h b/src/xrpld/app/ledger/Ledger.h index cbfbc0030f..cfa82074a1 100644 --- a/src/xrpld/app/ledger/Ledger.h +++ b/src/xrpld/app/ledger/Ledger.h @@ -391,11 +391,6 @@ private: /** A ledger wrapped in a CachedView. */ using CachedLedger = CachedView; -std::uint32_t constexpr FLAG_LEDGER_INTERVAL = 256; -/** Returns true if the given ledgerIndex is a flag ledgerIndex */ -bool -isFlagLedger(LedgerIndex seq); - //------------------------------------------------------------------------------ // // API diff --git a/src/xrpld/app/ledger/OrderBookDBImpl.cpp b/src/xrpld/app/ledger/OrderBookDBImpl.cpp index 62c03fb7ca..5c9d46edb1 100644 --- a/src/xrpld/app/ledger/OrderBookDBImpl.cpp +++ b/src/xrpld/app/ledger/OrderBookDBImpl.cpp @@ -1,12 +1,11 @@ #include #include -#include -#include #include #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/BuildLedger.cpp b/src/xrpld/app/ledger/detail/BuildLedger.cpp index 1414441b35..688363c102 100644 --- a/src/xrpld/app/ledger/detail/BuildLedger.cpp +++ b/src/xrpld/app/ledger/detail/BuildLedger.cpp @@ -2,10 +2,11 @@ #include #include #include +#include #include -#include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp index f54c79f9c0..69ab17ba0e 100644 --- a/src/xrpld/app/ledger/detail/LedgerCleaner.cpp +++ b/src/xrpld/app/ledger/detail/LedgerCleaner.cpp @@ -1,10 +1,10 @@ #include #include #include -#include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/ledger/detail/LedgerMaster.cpp b/src/xrpld/app/ledger/detail/LedgerMaster.cpp index 5538ebcb96..c6bd3963b4 100644 --- a/src/xrpld/app/ledger/detail/LedgerMaster.cpp +++ b/src/xrpld/app/ledger/detail/LedgerMaster.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -23,12 +21,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/ledger/detail/LedgerNodeHelpers.cpp b/src/xrpld/app/ledger/detail/LedgerNodeHelpers.cpp index 66774b66f3..931fc9eae6 100644 --- a/src/xrpld/app/ledger/detail/LedgerNodeHelpers.cpp +++ b/src/xrpld/app/ledger/detail/LedgerNodeHelpers.cpp @@ -2,10 +2,10 @@ #include #include -#include #include #include +#include #include #include #include diff --git a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp index b7d788e15a..273e3792d3 100644 --- a/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp +++ b/src/xrpld/app/ledger/detail/LedgerReplayTask.cpp @@ -72,9 +72,10 @@ LedgerReplayTask::LedgerReplayTask( , inboundLedgers_(inboundLedgers) , replayer_(replayer) , parameter_(parameter) - , maxTimeouts_(std::max( - LedgerReplayParameters::TASK_MAX_TIMEOUTS_MINIMUM, - parameter.totalLedgers_ * LedgerReplayParameters::TASK_MAX_TIMEOUTS_MULTIPLIER)) + , maxTimeouts_( + std::max( + LedgerReplayParameters::TASK_MAX_TIMEOUTS_MINIMUM, + parameter.totalLedgers_ * LedgerReplayParameters::TASK_MAX_TIMEOUTS_MULTIPLIER)) , skipListAcquirer_(skipListAcquirer) { JLOG(journal_.trace()) << "Create " << hash_; diff --git a/src/xrpld/app/ledger/detail/OpenLedger.cpp b/src/xrpld/app/ledger/detail/OpenLedger.cpp index d621285619..bc7223f6d9 100644 --- a/src/xrpld/app/ledger/detail/OpenLedger.cpp +++ b/src/xrpld/app/ledger/detail/OpenLedger.cpp @@ -1,13 +1,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/main/Application.cpp b/src/xrpld/app/main/Application.cpp index 4612479b78..292ee0b462 100644 --- a/src/xrpld/app/main/Application.cpp +++ b/src/xrpld/app/main/Application.cpp @@ -15,8 +15,6 @@ #include #include #include -#include -#include #include #include #include @@ -25,7 +23,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +49,9 @@ #include #include #include +#include #include +#include #include #include @@ -158,6 +160,7 @@ public: NodeCache m_tempNodeCache; CachedSLEs cachedSLEs_; + std::unique_ptr networkIDService_; std::optional> nodeIdentity_; ValidatorKeys const validatorKeys_; @@ -243,42 +246,44 @@ public: , m_journal(logs_->journal("Application")) // PerfLog must be started before any other threads are launched. - , perfLog_(perf::make_PerfLog( - perf::setup_PerfLog(config_->section("perf"), config_->CONFIG_DIR), - *this, - logs_->journal("PerfLog"), - [this] { signalStop("PerfLog"); })) + , perfLog_( + perf::make_PerfLog( + perf::setup_PerfLog(config_->section("perf"), config_->CONFIG_DIR), + *this, + logs_->journal("PerfLog"), + [this] { signalStop("PerfLog"); })) , m_txMaster(*this) , m_collectorManager(make_CollectorManager(config_->section(SECTION_INSIGHT), logs_->journal("Collector"))) - , m_jobQueue(std::make_unique( - [](std::unique_ptr const& config) { - if (config->standalone() && !config->FORCE_MULTI_THREAD) - return 1; + , m_jobQueue( + std::make_unique( + [](std::unique_ptr const& config) { + if (config->standalone() && !config->FORCE_MULTI_THREAD) + return 1; - if (config->WORKERS) - return config->WORKERS; + if (config->WORKERS) + return config->WORKERS; - auto count = static_cast(std::thread::hardware_concurrency()); + auto count = static_cast(std::thread::hardware_concurrency()); - // Be more aggressive about the number of threads to use - // for the job queue if the server is configured as - // "large" or "huge" if there are enough cores. - if (config->NODE_SIZE >= 4 && count >= 16) - count = 6 + std::min(count, 8); - else if (config->NODE_SIZE >= 3 && count >= 8) - count = 4 + std::min(count, 6); - else - count = 2 + std::min(count, 4); + // Be more aggressive about the number of threads to use + // for the job queue if the server is configured as + // "large" or "huge" if there are enough cores. + if (config->NODE_SIZE >= 4 && count >= 16) + count = 6 + std::min(count, 8); + else if (config->NODE_SIZE >= 3 && count >= 8) + count = 4 + std::min(count, 6); + else + count = 2 + std::min(count, 4); - return count; - }(config_), - m_collectorManager->group("jobq"), - logs_->journal("JobQueue"), - *logs_, - *perfLog_)) + return count; + }(config_), + m_collectorManager->group("jobq"), + logs_->journal("JobQueue"), + *logs_, + *perfLog_)) , m_nodeStoreScheduler(*m_jobQueue) @@ -288,6 +293,8 @@ public: , cachedSLEs_("Cached SLEs", 0, std::chrono::minutes(1), stopwatch(), logs_->journal("CachedSLEs")) + , networkIDService_(std::make_unique(config_->NETWORK_ID)) + , validatorKeys_(*config_, m_journal) , m_resourceManager(Resource::make_Manager(m_collectorManager->collector(), logs_->journal("Resource"))) @@ -301,11 +308,12 @@ public: , m_pathRequests( std::make_unique(*this, logs_->journal("PathRequest"), m_collectorManager->collector())) - , m_ledgerMaster(std::make_unique( - *this, - stopwatch(), - m_collectorManager->collector(), - logs_->journal("LedgerMaster"))) + , m_ledgerMaster( + std::make_unique( + *this, + stopwatch(), + m_collectorManager->collector(), + logs_->journal("LedgerMaster"))) , ledgerCleaner_(make_LedgerCleaner(*this, logs_->journal("LedgerCleaner"))) @@ -349,13 +357,14 @@ public: , publisherManifests_(std::make_unique(logs_->journal("ManifestCache"))) - , validators_(std::make_unique( - *validatorManifests_, - *publisherManifests_, - *timeKeeper_, - config_->legacy("database_path"), - logs_->journal("ValidatorList"), - config_->VALIDATION_QUORUM)) + , validators_( + std::make_unique( + *validatorManifests_, + *publisherManifests_, + *timeKeeper_, + config_->legacy("database_path"), + logs_->journal("ValidatorList"), + config_->VALIDATION_QUORUM)) , validatorSites_(std::make_unique(*this)) @@ -628,6 +637,12 @@ public: return cachedSLEs_; } + NetworkIDService& + getNetworkIDService() override + { + return *networkIDService_; + } + AmendmentTable& getAmendmentTable() override { diff --git a/src/xrpld/app/main/GRPCServer.cpp b/src/xrpld/app/main/GRPCServer.cpp index 9b07728eb8..5160a6779e 100644 --- a/src/xrpld/app/main/GRPCServer.cpp +++ b/src/xrpld/app/main/GRPCServer.cpp @@ -430,58 +430,62 @@ GRPCServerImpl::setupListeners() { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedger, - doLedgerGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedger, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedger, + doLedgerGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedger, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerData, - doLedgerDataGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerData, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerData, + doLedgerDataGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerData, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerDiff, - doLedgerDiffGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerDiff, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerDiff, + doLedgerDiffGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerDiff, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } { using cd = CallData; - addToRequests(std::make_shared( - service_, - *cq_, - app_, - &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerEntry, - doLedgerEntryGrpc, - &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerEntry, - RPC::NO_CONDITION, - Resource::feeMediumBurdenRPC, - secureGatewayIPs_)); + addToRequests( + std::make_shared( + service_, + *cq_, + app_, + &org::xrpl::rpc::v1::XRPLedgerAPIService::AsyncService::RequestGetLedgerEntry, + doLedgerEntryGrpc, + &org::xrpl::rpc::v1::XRPLedgerAPIService::Stub::GetLedgerEntry, + RPC::NO_CONDITION, + Resource::feeMediumBurdenRPC, + secureGatewayIPs_)); } return requests; } diff --git a/src/xrpld/app/main/LoadManager.cpp b/src/xrpld/app/main/LoadManager.cpp index 5e3b572e1d..d9da8e5159 100644 --- a/src/xrpld/app/main/LoadManager.cpp +++ b/src/xrpld/app/main/LoadManager.cpp @@ -1,9 +1,9 @@ #include #include -#include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/AmendmentTableImpl.h b/src/xrpld/app/misc/AmendmentTableImpl.h new file mode 100644 index 0000000000..fe7c067d5a --- /dev/null +++ b/src/xrpld/app/misc/AmendmentTableImpl.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +#include + +namespace xrpl { + +std::unique_ptr +make_AmendmentTable( + ServiceRegistry& registry, + std::chrono::seconds majorityTime, + std::vector const& supported, + Section const& enabled, + Section const& vetoed, + beast::Journal journal); + +} // namespace xrpl diff --git a/src/xrpld/app/misc/CanonicalTXSet.cpp b/src/xrpld/app/misc/CanonicalTXSet.cpp index 6e6102afe7..b9d1a45aa0 100644 --- a/src/xrpld/app/misc/CanonicalTXSet.cpp +++ b/src/xrpld/app/misc/CanonicalTXSet.cpp @@ -32,8 +32,9 @@ CanonicalTXSet::accountKey(AccountID const& account) void CanonicalTXSet::insert(std::shared_ptr const& txn) { - map_.insert(std::make_pair( - Key(accountKey(txn->getAccountID(sfAccount)), txn->getSeqProxy(), txn->getTransactionID()), txn)); + map_.insert( + std::make_pair( + Key(accountKey(txn->getAccountID(sfAccount)), txn->getSeqProxy(), txn->getTransactionID()), txn)); } std::shared_ptr diff --git a/src/xrpld/app/misc/NetworkOPs.cpp b/src/xrpld/app/misc/NetworkOPs.cpp index 8732f9610d..e26a339d94 100644 --- a/src/xrpld/app/misc/NetworkOPs.cpp +++ b/src/xrpld/app/misc/NetworkOPs.cpp @@ -10,9 +10,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -20,9 +18,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -38,9 +36,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -51,6 +51,8 @@ #include #include #include +#include +#include #include #include @@ -1101,8 +1103,8 @@ NetworkOPsImp::submitTransaction(std::shared_ptr const& iTrans) try { - auto const [validity, reason] = checkValidity( - registry_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules(), registry_.app().config()); + auto const [validity, reason] = + checkValidity(registry_.getHashRouter(), *trans, m_ledgerMaster.getValidatedRules()); if (validity != Validity::Valid) { @@ -1158,8 +1160,7 @@ NetworkOPsImp::preProcessTransaction(std::shared_ptr& transaction) // NOTE ximinez - I think this check is redundant, // but I'm not 100% sure yet. // If so, only cost is looking up HashRouter flags. - auto const [validity, reason] = - checkValidity(registry_.getHashRouter(), sttx, view->rules(), registry_.app().config()); + auto const [validity, reason] = checkValidity(registry_.getHashRouter(), sttx, view->rules()); XRPL_ASSERT(validity == Validity::Valid, "xrpl::NetworkOPsImp::processTransaction : valid validity"); // Not concerned with local checks at this point. @@ -2195,7 +2196,7 @@ NetworkOPsImp::pubValidation(std::shared_ptr const& val) jvObj[jss::flags] = val->getFlags(); jvObj[jss::signing_time] = *(*val)[~sfSigningTime]; jvObj[jss::data] = strHex(val->getSerializer().slice()); - jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; + jvObj[jss::network_id] = registry_.getNetworkIDService().getNetworkID(); if (auto version = (*val)[~sfServerVersion]) jvObj[jss::server_version] = std::to_string(*version); @@ -2844,7 +2845,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr const& lpAccepted) jvObj[jss::ledger_hash] = to_string(lpAccepted->header().hash); jvObj[jss::ledger_time] = Json::Value::UInt(lpAccepted->header().closeTime.time_since_epoch().count()); - jvObj[jss::network_id] = registry_.app().config().NETWORK_ID; + jvObj[jss::network_id] = registry_.getNetworkIDService().getNetworkID(); if (!lpAccepted->rules().enabled(featureXRPFees)) jvObj[jss::fee_ref] = Config::FEE_UNITS_DEPRECATED; @@ -2987,7 +2988,7 @@ NetworkOPsImp::transJson( lookup.second && lookup.second->isFieldPresent(sfTransactionIndex)) { uint32_t const txnSeq = lookup.second->getFieldU32(sfTransactionIndex); - uint32_t netID = registry_.app().config().NETWORK_ID; + uint32_t netID = registry_.getNetworkIDService().getNetworkID(); if (transaction->isFieldPresent(sfNetworkID)) netID = transaction->getFieldU32(sfNetworkID); @@ -3817,7 +3818,7 @@ NetworkOPsImp::subLedger(InfoSub::ref isrListener, Json::Value& jvResult) jvResult[jss::fee_base] = lpClosed->fees().base.jsonClipped(); jvResult[jss::reserve_base] = lpClosed->fees().reserve.jsonClipped(); jvResult[jss::reserve_inc] = lpClosed->fees().increment.jsonClipped(); - jvResult[jss::network_id] = registry_.app().config().NETWORK_ID; + jvResult[jss::network_id] = registry_.getNetworkIDService().getNetworkID(); } if ((mMode >= OperatingMode::SYNCING) && !isNeedNetworkLedger()) diff --git a/src/xrpld/app/misc/TxQ.h b/src/xrpld/app/misc/TxQ.h index b50ff1a0b5..a779741223 100644 --- a/src/xrpld/app/misc/TxQ.h +++ b/src/xrpld/app/misc/TxQ.h @@ -1,13 +1,12 @@ #pragma once -#include - #include #include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/ValidatorList.h b/src/xrpld/app/misc/ValidatorList.h index f93ac8a32f..dd8eecc259 100644 --- a/src/xrpld/app/misc/ValidatorList.h +++ b/src/xrpld/app/misc/ValidatorList.h @@ -596,13 +596,14 @@ public: May be called concurrently */ void - for_each_available(std::function const& blobInfos, - PublicKey const& pubKey, - std::size_t maxSequence, - uint256 const& hash)> func) const; + for_each_available( + std::function const& blobInfos, + PublicKey const& pubKey, + std::size_t maxSequence, + uint256 const& hash)> func) const; /** Returns the current valid list for the given publisher key, if available, as a Json object. diff --git a/src/xrpld/app/misc/detail/AccountTxPaging.cpp b/src/xrpld/app/misc/detail/AccountTxPaging.cpp index e3fc2de4f8..63457f00ac 100644 --- a/src/xrpld/app/misc/detail/AccountTxPaging.cpp +++ b/src/xrpld/app/misc/detail/AccountTxPaging.cpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace xrpl { @@ -30,7 +31,7 @@ convertBlobsToTxResult( Transaction::sqlTransactionStatus(status), ledger_index, metaset->getAsObject().getFieldU32(sfTransactionIndex), - app.config().NETWORK_ID); + app.getNetworkIDService().getNetworkID()); else tr->setStatus(Transaction::sqlTransactionStatus(status), ledger_index); diff --git a/src/xrpld/app/misc/detail/AmendmentTable.cpp b/src/xrpld/app/misc/detail/AmendmentTable.cpp index 767a3d87f9..f7d662368e 100644 --- a/src/xrpld/app/misc/detail/AmendmentTable.cpp +++ b/src/xrpld/app/misc/detail/AmendmentTable.cpp @@ -1,7 +1,5 @@ -#include -#include - #include +#include #include #include #include diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index dfcbdbb3ad..12c76d50e8 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -523,11 +523,12 @@ ManifestCache::load( if (!configRevocation.empty()) { std::string revocationStr; - revocationStr.reserve(std::accumulate( - configRevocation.cbegin(), - configRevocation.cend(), - std::size_t(0), - [](std::size_t init, std::string const& s) { return init + s.size(); })); + revocationStr.reserve( + std::accumulate( + configRevocation.cbegin(), + configRevocation.cend(), + std::size_t(0), + [](std::size_t init, std::string const& s) { return init + s.size(); })); for (auto const& line : configRevocation) revocationStr += boost::algorithm::trim_copy(line); diff --git a/src/xrpld/app/misc/detail/Transaction.cpp b/src/xrpld/app/misc/detail/Transaction.cpp index d45c49c3c4..04fb762ef2 100644 --- a/src/xrpld/app/misc/detail/Transaction.cpp +++ b/src/xrpld/app/misc/detail/Transaction.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/app/misc/detail/TxQ.cpp b/src/xrpld/app/misc/detail/TxQ.cpp index 61741b73f0..e109e16834 100644 --- a/src/xrpld/app/misc/detail/TxQ.cpp +++ b/src/xrpld/app/misc/detail/TxQ.cpp @@ -1,12 +1,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include diff --git a/src/xrpld/app/misc/detail/ValidatorList.cpp b/src/xrpld/app/misc/detail/ValidatorList.cpp index 4730df4983..eb47e7eaf3 100644 --- a/src/xrpld/app/misc/detail/ValidatorList.cpp +++ b/src/xrpld/app/misc/detail/ValidatorList.cpp @@ -1595,13 +1595,14 @@ ValidatorList::for_each_listed(std::function func) } void -ValidatorList::for_each_available(std::function const& blobInfos, - PublicKey const& pubKey, - std::size_t maxSequence, - uint256 const& hash)> func) const +ValidatorList::for_each_available( + std::function const& blobInfos, + PublicKey const& pubKey, + std::size_t maxSequence, + uint256 const& hash)> func) const { std::shared_lock read_lock{mutex_}; diff --git a/src/xrpld/app/misc/setup_HashRouter.h b/src/xrpld/app/misc/setup_HashRouter.h index 3054233b89..9b767d0170 100644 --- a/src/xrpld/app/misc/setup_HashRouter.h +++ b/src/xrpld/app/misc/setup_HashRouter.h @@ -1,5 +1,4 @@ -#ifndef XRPLD_APP_MISC_SETUP_HASHROUTER_H_INCLUDED -#define XRPLD_APP_MISC_SETUP_HASHROUTER_H_INCLUDED +#pragma once #include @@ -13,5 +12,3 @@ HashRouter::Setup setup_HashRouter(Config const& config); } // namespace xrpl - -#endif diff --git a/src/xrpld/app/paths/AMMLiquidity.h b/src/xrpld/app/paths/AMMLiquidity.h index 441c3b6e3d..5c3ff2a8e6 100644 --- a/src/xrpld/app/paths/AMMLiquidity.h +++ b/src/xrpld/app/paths/AMMLiquidity.h @@ -1,13 +1,12 @@ #pragma once -#include -#include -#include - #include #include #include #include +#include +#include +#include namespace xrpl { diff --git a/src/xrpld/app/paths/PathRequest.cpp b/src/xrpld/app/paths/PathRequest.cpp index 53a4e03752..02f2f1313b 100644 --- a/src/xrpld/app/paths/PathRequest.cpp +++ b/src/xrpld/app/paths/PathRequest.cpp @@ -1,9 +1,7 @@ #include -#include #include #include #include -#include #include #include #include @@ -13,7 +11,9 @@ #include #include #include +#include #include +#include #include #include diff --git a/src/xrpld/app/paths/Pathfinder.cpp b/src/xrpld/app/paths/Pathfinder.cpp index ea4fa2013a..980803f305 100644 --- a/src/xrpld/app/paths/Pathfinder.cpp +++ b/src/xrpld/app/paths/Pathfinder.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/BookStep.cpp b/src/xrpld/app/paths/detail/BookStep.cpp index b9c8aa4e67..a3c559940f 100644 --- a/src/xrpld/app/paths/detail/BookStep.cpp +++ b/src/xrpld/app/paths/detail/BookStep.cpp @@ -1,9 +1,5 @@ -#include #include #include -#include -#include -#include #include #include @@ -14,6 +10,10 @@ #include #include #include +#include +#include +#include +#include #include diff --git a/src/xrpld/app/paths/detail/DirectStep.cpp b/src/xrpld/app/paths/detail/DirectStep.cpp index 806204bae2..e4617708fc 100644 --- a/src/xrpld/app/paths/detail/DirectStep.cpp +++ b/src/xrpld/app/paths/detail/DirectStep.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/PaySteps.cpp b/src/xrpld/app/paths/detail/PaySteps.cpp index e891fb6321..6f8d1e93ac 100644 --- a/src/xrpld/app/paths/detail/PaySteps.cpp +++ b/src/xrpld/app/paths/detail/PaySteps.cpp @@ -1,10 +1,9 @@ -#include - #include #include #include #include #include +#include #include diff --git a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp index 60f95a9b0b..1f1b908e64 100644 --- a/src/xrpld/app/paths/detail/XRPEndpointStep.cpp +++ b/src/xrpld/app/paths/detail/XRPEndpointStep.cpp @@ -1,6 +1,4 @@ -#include #include -#include #include #include @@ -9,6 +7,8 @@ #include #include #include +#include +#include #include diff --git a/src/xrpld/app/rdb/backend/detail/Node.cpp b/src/xrpld/app/rdb/backend/detail/Node.cpp index 01e036731c..e6e8062674 100644 --- a/src/xrpld/app/rdb/backend/detail/Node.cpp +++ b/src/xrpld/app/rdb/backend/detail/Node.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -306,7 +307,7 @@ saveValidatedLedger( acceptedLedgerTx->getTxn()->getMetaSQL(seq, acceptedLedgerTx->getEscMeta()) + ";"); app.getMasterTransaction().inLedger( - transactionID, seq, acceptedLedgerTx->getTxnSeq(), app.config().NETWORK_ID); + transactionID, seq, acceptedLedgerTx->getTxnSeq(), app.getNetworkIDService().getNetworkID()); } tr.commit(); @@ -555,8 +556,9 @@ std::pair>, int> getTxHistory(soci::session& session, Application& app, LedgerIndex startIndex, int quantity) { std::string sql = boost::str( - boost::format("SELECT LedgerSeq, Status, RawTxn " - "FROM Transactions ORDER BY LedgerSeq DESC LIMIT %u,%u;") % + boost::format( + "SELECT LedgerSeq, Status, RawTxn " + "FROM Transactions ORDER BY LedgerSeq DESC LIMIT %u,%u;") % startIndex % quantity); std::vector> txs; @@ -658,18 +660,20 @@ transactionsSQL( if (count) sql = boost::str( - boost::format("SELECT %s FROM AccountTransactions " - "WHERE Account = '%s' %s %s LIMIT %u, %u;") % + boost::format( + "SELECT %s FROM AccountTransactions " + "WHERE Account = '%s' %s %s LIMIT %u, %u;") % selection % toBase58(options.account) % maxClause % minClause % options.offset % numberOfResults); else sql = boost::str( - boost::format("SELECT %s FROM " - "AccountTransactions INNER JOIN Transactions " - "ON Transactions.TransID = AccountTransactions.TransID " - "WHERE Account = '%s' %s %s " - "ORDER BY AccountTransactions.LedgerSeq %s, " - "AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s " - "LIMIT %u, %u;") % + boost::format( + "SELECT %s FROM " + "AccountTransactions INNER JOIN Transactions " + "ON Transactions.TransID = AccountTransactions.TransID " + "WHERE Account = '%s' %s %s " + "ORDER BY AccountTransactions.LedgerSeq %s, " + "AccountTransactions.TxnSeq %s, AccountTransactions.TransID %s " + "LIMIT %u, %u;") % selection % toBase58(options.account) % maxClause % minClause % (descending ? "DESC" : "ASC") % (descending ? "DESC" : "ASC") % (descending ? "DESC" : "ASC") % options.offset % numberOfResults); JLOG(j.trace()) << "txSQL query: " << sql; diff --git a/src/xrpld/core/NetworkIDServiceImpl.h b/src/xrpld/core/NetworkIDServiceImpl.h new file mode 100644 index 0000000000..1176f8d4ac --- /dev/null +++ b/src/xrpld/core/NetworkIDServiceImpl.h @@ -0,0 +1,32 @@ +#pragma once + +#include + +#include + +namespace xrpl { + +// Forward declaration +class Config; + +/** Implementation of NetworkIDService that reads from Config. + + This class provides a NetworkIDService interface that wraps + the network ID from the application Config. It caches the + network ID at construction time. +*/ +class NetworkIDServiceImpl final : public NetworkIDService +{ +public: + explicit NetworkIDServiceImpl(std::uint32_t networkID); + + ~NetworkIDServiceImpl() override = default; + + std::uint32_t + getNetworkID() const noexcept override; + +private: + std::uint32_t networkID_; +}; + +} // namespace xrpl diff --git a/src/xrpld/core/detail/NetworkIDServiceImpl.cpp b/src/xrpld/core/detail/NetworkIDServiceImpl.cpp new file mode 100644 index 0000000000..839eb0c464 --- /dev/null +++ b/src/xrpld/core/detail/NetworkIDServiceImpl.cpp @@ -0,0 +1,16 @@ +#include +#include + +namespace xrpl { + +NetworkIDServiceImpl::NetworkIDServiceImpl(std::uint32_t networkID) : networkID_(networkID) +{ +} + +std::uint32_t +NetworkIDServiceImpl::getNetworkID() const noexcept +{ + return networkID_; +} + +} // namespace xrpl diff --git a/src/xrpld/overlay/Slot.h b/src/xrpld/overlay/Slot.h index f3fd919648..d0f2c62174 100644 --- a/src/xrpld/overlay/Slot.h +++ b/src/xrpld/overlay/Slot.h @@ -492,13 +492,15 @@ Slot::getPeers() const auto r = std::unordered_map>(); for (auto const& [id, info] : peers_) - r.emplace(std::make_pair( - id, - std::move(std::make_tuple( - info.state, - info.count, - epoch(info.expire).count(), - epoch(info.lastMessage).count())))); + r.emplace( + std::make_pair( + id, + std::move( + std::make_tuple( + info.state, + info.count, + epoch(info.expire).count(), + epoch(info.lastMessage).count())))); return r; } @@ -724,10 +726,11 @@ Slots::updateSlotAndSquelch( if (it == slots_.end()) { JLOG(journal_.trace()) << "updateSlotAndSquelch: new slot " << Slice(validator); - auto it = slots_ - .emplace(std::make_pair( - validator, Slot(handler_, logs_.journal("Slot"), maxSelectedPeers_))) - .first; + auto it = + slots_ + .emplace( + std::make_pair(validator, Slot(handler_, logs_.journal("Slot"), maxSelectedPeers_))) + .first; it->second.update(validator, id, type, callback); } else diff --git a/src/xrpld/overlay/detail/ConnectAttempt.cpp b/src/xrpld/overlay/detail/ConnectAttempt.cpp index 8de737f46d..61fb9d704a 100644 --- a/src/xrpld/overlay/detail/ConnectAttempt.cpp +++ b/src/xrpld/overlay/detail/ConnectAttempt.cpp @@ -180,8 +180,9 @@ ConnectAttempt::setTimer(ConnectionStep step) try { timer_.expires_after(connectTimeout); - timer_.async_wait(boost::asio::bind_executor( - strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); + timer_.async_wait( + boost::asio::bind_executor( + strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); } catch (std::exception const& ex) { @@ -218,8 +219,9 @@ ConnectAttempt::setTimer(ConnectionStep step) // call to expires_after cancels previous timer stepTimer_.expires_after(stepTimeout); - stepTimer_.async_wait(boost::asio::bind_executor( - strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); + stepTimer_.async_wait( + boost::asio::bind_executor( + strand_, std::bind(&ConnectAttempt::onTimer, shared_from_this(), std::placeholders::_1))); JLOG(journal_.trace()) << "setTimer: " << stepToString(step) << " timeout=" << stepTimeout.count() << "s"; } diff --git a/src/xrpld/overlay/detail/OverlayImpl.cpp b/src/xrpld/overlay/detail/OverlayImpl.cpp index 5b9f142001..29cab0ee6d 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.cpp +++ b/src/xrpld/overlay/detail/OverlayImpl.cpp @@ -60,8 +60,9 @@ void OverlayImpl::Timer::async_wait() { timer_.expires_after(std::chrono::seconds(1)); - timer_.async_wait(boost::asio::bind_executor( - overlay_.strand_, std::bind(&Timer::on_timer, shared_from_this(), std::placeholders::_1))); + timer_.async_wait( + boost::asio::bind_executor( + overlay_.strand_, std::bind(&Timer::on_timer, shared_from_this(), std::placeholders::_1))); } void diff --git a/src/xrpld/overlay/detail/OverlayImpl.h b/src/xrpld/overlay/detail/OverlayImpl.h index 19fff6a29a..ca20ed6733 100644 --- a/src/xrpld/overlay/detail/OverlayImpl.h +++ b/src/xrpld/overlay/detail/OverlayImpl.h @@ -191,7 +191,8 @@ public: std::size_t& disabled, std::size_t& enabledInSkip) const; - void checkTracking(std::uint32_t) override; + void + checkTracking(std::uint32_t) override; std::shared_ptr findPeerByShortID(Peer::id_t const& id) const override; diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index 0426127441..bc393c214b 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -3,11 +3,8 @@ #include #include #include -#include -#include #include #include -#include #include #include #include @@ -18,9 +15,12 @@ #include #include #include +#include #include #include +#include #include +#include #include #include @@ -533,8 +533,7 @@ void PeerImp::fail(std::string const& reason) { if (!strand_.running_in_this_thread()) - return post( - strand_, std::bind((void(Peer::*)(std::string const&)) & PeerImp::fail, shared_from_this(), reason)); + return post(strand_, std::bind((void (Peer::*)(std::string const&))&PeerImp::fail, shared_from_this(), reason)); if (!socket_.is_open()) return; @@ -2724,8 +2723,8 @@ PeerImp::checkTransaction( if (checkSignature) { // Check the signature before handing off to the job queue. - if (auto [valid, validReason] = checkValidity( - app_.getHashRouter(), *stx, app_.getLedgerMaster().getValidatedRules(), app_.config()); + if (auto [valid, validReason] = + checkValidity(app_.getHashRouter(), *stx, app_.getLedgerMaster().getValidatedRules()); valid != Validity::Valid) { if (!validReason.empty()) diff --git a/src/xrpld/rpc/detail/LegacyPathFind.cpp b/src/xrpld/rpc/detail/LegacyPathFind.cpp index 9d9b7e138c..b0fa07d676 100644 --- a/src/xrpld/rpc/detail/LegacyPathFind.cpp +++ b/src/xrpld/rpc/detail/LegacyPathFind.cpp @@ -1,10 +1,10 @@ #include -#include #include #include #include #include +#include namespace xrpl { namespace RPC { diff --git a/src/xrpld/rpc/detail/RPCHelpers.cpp b/src/xrpld/rpc/detail/RPCHelpers.cpp index 4a0339b763..3edc7de97e 100644 --- a/src/xrpld/rpc/detail/RPCHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCHelpers.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp index 2f3326a8e1..18acdd3fe1 100644 --- a/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp +++ b/src/xrpld/rpc/detail/RPCLedgerHelpers.cpp @@ -355,8 +355,9 @@ getOrAcquireLedger(RPC::JsonContext const& context) if ((hasHash + hasIndex) != 1) { return Unexpected( - RPC::make_param_error("Exactly one of 'ledger_hash' or " - "'ledger_index' can be specified.")); + RPC::make_param_error( + "Exactly one of 'ledger_hash' or " + "'ledger_index' can be specified.")); } if (hasHash) diff --git a/src/xrpld/rpc/detail/TransactionSign.cpp b/src/xrpld/rpc/detail/TransactionSign.cpp index 5e71d2c427..123123f36b 100644 --- a/src/xrpld/rpc/detail/TransactionSign.cpp +++ b/src/xrpld/rpc/detail/TransactionSign.cpp @@ -4,14 +4,13 @@ #include #include #include -#include // Validity::Valid -#include #include #include #include #include #include +#include #include #include #include @@ -19,6 +18,8 @@ #include #include #include +#include // Validity::Valid +#include #include #include @@ -466,7 +467,7 @@ transactionPreProcessImpl( if (!tx_json.isMember(jss::NetworkID)) { - auto const networkId = app.config().NETWORK_ID; + auto const networkId = app.getNetworkIDService().getNetworkID(); if (networkId > 1024) tx_json[jss::NetworkID] = to_string(networkId); } @@ -637,7 +638,7 @@ transactionConstructImpl(std::shared_ptr const& stTx, Rules const& r auto sttxNew = std::make_shared(sit); if (!app.checkSigs()) forceValidity(app.getHashRouter(), sttxNew->getTransactionID(), Validity::SigGoodOnly); - if (checkValidity(app.getHashRouter(), *sttxNew, rules, app.config()).first != Validity::Valid) + if (checkValidity(app.getHashRouter(), *sttxNew, rules).first != Validity::Valid) { ret.first = RPC::make_error(rpcINTERNAL, "Invalid signature."); return ret; diff --git a/src/xrpld/rpc/detail/TransactionSign.h b/src/xrpld/rpc/detail/TransactionSign.h index 8d064d65d5..a12f60617d 100644 --- a/src/xrpld/rpc/detail/TransactionSign.h +++ b/src/xrpld/rpc/detail/TransactionSign.h @@ -1,9 +1,9 @@ #pragma once -#include #include #include +#include #include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/AMMInfo.cpp b/src/xrpld/rpc/handlers/AMMInfo.cpp index 74e6f8944d..e4234096ee 100644 --- a/src/xrpld/rpc/handlers/AMMInfo.cpp +++ b/src/xrpld/rpc/handlers/AMMInfo.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/AccountObjects.cpp b/src/xrpld/rpc/handlers/AccountObjects.cpp index d9906efd70..7ef30255bc 100644 --- a/src/xrpld/rpc/handlers/AccountObjects.cpp +++ b/src/xrpld/rpc/handlers/AccountObjects.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -12,6 +11,7 @@ #include #include #include +#include #include diff --git a/src/xrpld/rpc/handlers/Feature1.cpp b/src/xrpld/rpc/handlers/Feature1.cpp index 6f9d440185..bd1e501506 100644 --- a/src/xrpld/rpc/handlers/Feature1.cpp +++ b/src/xrpld/rpc/handlers/Feature1.cpp @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index 440ed11c18..489e0c87ca 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -200,16 +200,18 @@ parseAuthorizeCredentials(Json::Value const& jv) std::uint32_t const n = jv.size(); if (n > maxCredentialsArraySize) { - return Unexpected(LedgerEntryHelpers::malformedError( - "malformedAuthorizedCredentials", - "Invalid field '" + std::string(jss::authorized_credentials) + "', array too long.")); + return Unexpected( + LedgerEntryHelpers::malformedError( + "malformedAuthorizedCredentials", + "Invalid field '" + std::string(jss::authorized_credentials) + "', array too long.")); } if (n == 0) { - return Unexpected(LedgerEntryHelpers::malformedError( - "malformedAuthorizedCredentials", - "Invalid field '" + std::string(jss::authorized_credentials) + "', array empty.")); + return Unexpected( + LedgerEntryHelpers::malformedError( + "malformedAuthorizedCredentials", + "Invalid field '" + std::string(jss::authorized_credentials) + "', array empty.")); } STArray arr(sfAuthorizeCredentials, n); diff --git a/src/xrpld/rpc/handlers/LedgerHandler.cpp b/src/xrpld/rpc/handlers/LedgerHandler.cpp index 343d21e3f5..d0572f42b2 100644 --- a/src/xrpld/rpc/handlers/LedgerHandler.cpp +++ b/src/xrpld/rpc/handlers/LedgerHandler.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include namespace xrpl { namespace RPC { diff --git a/src/xrpld/rpc/handlers/NoRippleCheck.cpp b/src/xrpld/rpc/handlers/NoRippleCheck.cpp index 23ce82ef72..61e3bd61bd 100644 --- a/src/xrpld/rpc/handlers/NoRippleCheck.cpp +++ b/src/xrpld/rpc/handlers/NoRippleCheck.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -11,6 +10,7 @@ #include #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Peers.cpp b/src/xrpld/rpc/handlers/Peers.cpp index 5232070b2b..b343c4050b 100644 --- a/src/xrpld/rpc/handlers/Peers.cpp +++ b/src/xrpld/rpc/handlers/Peers.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -7,6 +6,7 @@ #include #include +#include namespace xrpl { diff --git a/src/xrpld/rpc/handlers/Simulate.cpp b/src/xrpld/rpc/handlers/Simulate.cpp index 58b40e2048..c35322a35e 100644 --- a/src/xrpld/rpc/handlers/Simulate.cpp +++ b/src/xrpld/rpc/handlers/Simulate.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -10,11 +9,13 @@ #include #include +#include #include #include #include #include #include +#include namespace xrpl { @@ -128,7 +129,7 @@ autofillTx(Json::Value& tx_json, RPC::JsonContext& context) if (!tx_json.isMember(jss::NetworkID)) { - auto const networkId = context.app.config().NETWORK_ID; + auto const networkId = context.app.getNetworkIDService().getNetworkID(); if (networkId > 1024) tx_json[jss::NetworkID] = to_string(networkId); } diff --git a/src/xrpld/rpc/handlers/Submit.cpp b/src/xrpld/rpc/handlers/Submit.cpp index 577501d581..2911d0ca45 100644 --- a/src/xrpld/rpc/handlers/Submit.cpp +++ b/src/xrpld/rpc/handlers/Submit.cpp @@ -1,12 +1,12 @@ #include #include -#include #include #include #include #include #include +#include namespace xrpl { @@ -76,8 +76,8 @@ doSubmit(RPC::JsonContext& context) { if (!context.app.checkSigs()) forceValidity(context.app.getHashRouter(), stTx->getTransactionID(), Validity::SigGoodOnly); - auto [validity, reason] = checkValidity( - context.app.getHashRouter(), *stTx, context.ledgerMaster.getCurrentLedger()->rules(), context.app.config()); + auto [validity, reason] = + checkValidity(context.app.getHashRouter(), *stTx, context.ledgerMaster.getCurrentLedger()->rules()); if (validity != Validity::Valid) { jvResult[jss::error] = "invalidTransaction"; diff --git a/src/xrpld/rpc/handlers/Tx.cpp b/src/xrpld/rpc/handlers/Tx.cpp index d2d7bed04d..e78a31d73c 100644 --- a/src/xrpld/rpc/handlers/Tx.cpp +++ b/src/xrpld/rpc/handlers/Tx.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -147,7 +148,7 @@ doTxHelp(RPC::Context& context, TxArgs args) { uint32_t lgrSeq = ledger->header().seq; uint32_t txnIdx = meta->getAsObject().getFieldU32(sfTransactionIndex); - uint32_t netID = context.app.config().NETWORK_ID; + uint32_t netID = context.app.getNetworkIDService().getNetworkID(); if (txnIdx <= 0xFFFFU && netID < 0xFFFFU && lgrSeq < 0x0FFF'FFFFUL) result.ctid = RPC::encodeCTID(lgrSeq, (uint32_t)txnIdx, (uint32_t)netID); @@ -267,7 +268,7 @@ doTxJson(RPC::JsonContext& context) return rpcError(rpcINVALID_PARAMS); auto const [lgr_seq, txn_idx, net_id] = *ctid; - if (net_id != context.app.config().NETWORK_ID) + if (net_id != context.app.getNetworkIDService().getNetworkID()) { std::stringstream out; out << "Wrong network. You should submit this request to a node " diff --git a/src/xrpld/shamap/NodeFamily.cpp b/src/xrpld/shamap/NodeFamily.cpp index a05e89dc84..a0821ea202 100644 --- a/src/xrpld/shamap/NodeFamily.cpp +++ b/src/xrpld/shamap/NodeFamily.cpp @@ -10,19 +10,21 @@ NodeFamily::NodeFamily(Application& app, CollectorManager& cm) : app_(app) , db_(app.getNodeStore()) , j_(app.journal("NodeFamily")) - , fbCache_(std::make_shared( - "Node family full below cache", - stopwatch(), - app.journal("NodeFamilyFulLBelowCache"), - cm.collector(), - fullBelowTargetSize, - fullBelowExpiration)) - , tnCache_(std::make_shared( - "Node family tree node cache", - app.config().getValueFor(SizedItem::treeCacheSize), - std::chrono::seconds(app.config().getValueFor(SizedItem::treeCacheAge)), - stopwatch(), - j_)) + , fbCache_( + std::make_shared( + "Node family full below cache", + stopwatch(), + app.journal("NodeFamilyFulLBelowCache"), + cm.collector(), + fullBelowTargetSize, + fullBelowExpiration)) + , tnCache_( + std::make_shared( + "Node family tree node cache", + app.config().getValueFor(SizedItem::treeCacheSize), + std::chrono::seconds(app.config().getValueFor(SizedItem::treeCacheAge)), + stopwatch(), + j_)) { }