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