rippled
Loading...
Searching...
No Matches
LedgerClosed_test.cpp
1#include <test/jtx.h>
2
3#include <xrpl/protocol/Feature.h>
4#include <xrpl/protocol/jss.h>
5
6namespace ripple {
7
9{
10public:
11 void
13 {
14 using namespace test::jtx;
15
16 // This test relies on ledger hash so must lock it to fee 10.
17 auto p = envconfig();
18 p->FEES.reference_fee = 10;
19 Env env{*this, std::move(p), FeatureBitset{}};
20 Account const alice{"alice"};
21 env.fund(XRP(10000), alice);
22
23 auto lc_result = env.rpc("ledger_closed")[jss::result];
24 BEAST_EXPECT(
25 lc_result[jss::ledger_hash] ==
26 "CCC3B3E88CCAC17F1BE6B4A648A55999411F19E3FE55EB721960EB0DF28EDDA5");
27 BEAST_EXPECT(lc_result[jss::ledger_index] == 2);
28
29 env.close();
30 auto const ar_master = env.le(env.master);
31 BEAST_EXPECT(ar_master->getAccountID(sfAccount) == env.master.id());
32 BEAST_EXPECT((*ar_master)[sfBalance] == drops(99999989999999980));
33
34 auto const ar_alice = env.le(alice);
35 BEAST_EXPECT(ar_alice->getAccountID(sfAccount) == alice.id());
36 BEAST_EXPECT((*ar_alice)[sfBalance] == XRP(10000));
37
38 lc_result = env.rpc("ledger_closed")[jss::result];
39 BEAST_EXPECT(
40 lc_result[jss::ledger_hash] ==
41 "E86DE7F3D7A4D9CE17EF7C8BA08A8F4D8F643B9552F0D895A31CDA78F541DE4E");
42 BEAST_EXPECT(lc_result[jss::ledger_index] == 3);
43 }
44
45 void
46 run() override
47 {
49 }
50};
51
52BEAST_DEFINE_TESTSUITE(LedgerClosed, rpc, ripple);
53
54} // namespace ripple
A testsuite class.
Definition suite.h:52
void run() override
Runs the suite.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6