Files
rippled/src/test/rpc/LedgerClosed_test.cpp
Bart 1d42c4f6de refactor: Remove unnecessary copyright notices already covered by LICENSE.md (#5929)
Per XLS-0095, we are taking steps to rename ripple(d) to xrpl(d).

This change specifically removes all copyright notices referencing Ripple, XRPLF, and certain affiliated contributors upon mutual agreement, so the notice in the LICENSE.md file applies throughout. Copyright notices referencing external contributions remain as-is. Duplicate verbiage is also removed.
2025-11-04 08:33:42 +00:00

55 lines
1.6 KiB
C++

#include <test/jtx.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/jss.h>
namespace ripple {
class LedgerClosed_test : public beast::unit_test::suite
{
public:
void
testMonitorRoot()
{
using namespace test::jtx;
// This test relies on ledger hash so must lock it to fee 10.
auto p = envconfig();
p->FEES.reference_fee = 10;
Env env{*this, std::move(p), FeatureBitset{}};
Account const alice{"alice"};
env.fund(XRP(10000), alice);
auto lc_result = env.rpc("ledger_closed")[jss::result];
BEAST_EXPECT(
lc_result[jss::ledger_hash] ==
"CCC3B3E88CCAC17F1BE6B4A648A55999411F19E3FE55EB721960EB0DF28EDDA5");
BEAST_EXPECT(lc_result[jss::ledger_index] == 2);
env.close();
auto const ar_master = env.le(env.master);
BEAST_EXPECT(ar_master->getAccountID(sfAccount) == env.master.id());
BEAST_EXPECT((*ar_master)[sfBalance] == drops(99999989999999980));
auto const ar_alice = env.le(alice);
BEAST_EXPECT(ar_alice->getAccountID(sfAccount) == alice.id());
BEAST_EXPECT((*ar_alice)[sfBalance] == XRP(10000));
lc_result = env.rpc("ledger_closed")[jss::result];
BEAST_EXPECT(
lc_result[jss::ledger_hash] ==
"E86DE7F3D7A4D9CE17EF7C8BA08A8F4D8F643B9552F0D895A31CDA78F541DE4E");
BEAST_EXPECT(lc_result[jss::ledger_index] == 3);
}
void
run() override
{
testMonitorRoot();
}
};
BEAST_DEFINE_TESTSUITE(LedgerClosed, rpc, ripple);
} // namespace ripple