xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
test
rpc
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
14
namespace
xrpl
{
15
16
class
LedgerClosed_test
:
public
beast::unit_test::Suite
17
{
18
public
:
19
void
20
testMonitorRoot
()
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
{
56
testMonitorRoot
();
57
}
58
};
59
60
BEAST_DEFINE_TESTSUITE
(LedgerClosed,
rpc
,
xrpl
);
61
62
}
// namespace xrpl
beast::unit_test::Suite
A testsuite class.
Definition
suite.h:52
xrpl::FeatureBitset
Definition
Feature.h:196
xrpl::LedgerClosed_test
Definition
LedgerClosed_test.cpp:17
xrpl::LedgerClosed_test::testMonitorRoot
void testMonitorRoot()
Definition
LedgerClosed_test.cpp:20
xrpl::LedgerClosed_test::run
void run() override
Runs the suite.
Definition
LedgerClosed_test.cpp:54
xrpl::rpc
API version numbers used in later API versions.
Definition
ApiVersion.h:36
xrpl::test::jtx
Definition
Oracle_test.cpp:34
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::FeePayerType::Account
@ Account
Definition
Transactor.h:145
xrpl::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(AccountTxPaging, app, xrpl)
utility
Generated by
1.17.0