From 08b3a199a44896a05d0657b03dc424cf90e5ef48 Mon Sep 17 00:00:00 2001 From: Denis Angell Date: Mon, 7 Oct 2024 19:54:20 +0200 Subject: [PATCH] misc --- Builds/CMake/RippledCore.cmake | 1 + src/ripple/app/misc/NetworkOPs.cpp | 2 +- src/ripple/consensus/ConsensusTypes.h | 3 ++ src/test/app/Memory_test.cpp | 64 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/test/app/Memory_test.cpp diff --git a/Builds/CMake/RippledCore.cmake b/Builds/CMake/RippledCore.cmake index cc3441af5..219e1409f 100644 --- a/Builds/CMake/RippledCore.cmake +++ b/Builds/CMake/RippledCore.cmake @@ -726,6 +726,7 @@ if (tests) src/test/app/LedgerReplay_test.cpp src/test/app/LoadFeeTrack_test.cpp src/test/app/Manifest_test.cpp + src/test/app/Memory_test.cpp src/test/app/MultiSign_test.cpp src/test/app/NetworkID_test.cpp src/test/app/NFToken_test.cpp diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 6f6bfcc1c..8f81ba564 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -733,7 +733,7 @@ private: RCLConsensus mConsensus; - ConsensusPhase mLastConsensusPhase; + ConsensusPhase mLastConsensusPhase = ConsensusPhase::unknown; LedgerMaster& m_ledgerMaster; diff --git a/src/ripple/consensus/ConsensusTypes.h b/src/ripple/consensus/ConsensusTypes.h index 05d03c8a9..117fa618a 100644 --- a/src/ripple/consensus/ConsensusTypes.h +++ b/src/ripple/consensus/ConsensusTypes.h @@ -101,6 +101,9 @@ to_string(ConsensusMode m) consensus will internally go back to open (see Consensus::handleWrongLedger). */ enum class ConsensusPhase { + //! We dont know the ConsensusPhase + unknown, + //! We haven't closed our ledger yet, but others might have open, diff --git a/src/test/app/Memory_test.cpp b/src/test/app/Memory_test.cpp new file mode 100644 index 000000000..4d1824284 --- /dev/null +++ b/src/test/app/Memory_test.cpp @@ -0,0 +1,64 @@ +//------------------------------------------------------------------------------ +/* + This file is part of rippled: https://github.com/ripple/rippled + Copyright (c) 2023 XRPL-Labs + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ +//============================================================================== + +#include +#include +#include +#include + +namespace ripple { +namespace test { + +class Memory_test : public beast::unit_test::suite +{ + void + testPayment(FeatureBitset features) + { + testcase("payment"); + + using namespace test::jtx; + using namespace std::literals; + + Env env{*this, envconfig(), features}; + + auto const account = Account("alice"); + env.fund(XRP(1000), account); + env.close(); + } + + void + testWithFeats(FeatureBitset features) + { + testPayment(features); + } + +public: + void + run() override + { + using namespace test::jtx; + auto const sa = supported_amendments(); + testWithFeats(sa); + } +}; + +BEAST_DEFINE_TESTSUITE(Memory, app, ripple); + +} // namespace test +} // namespace ripple