xrpld
Loading...
Searching...
No Matches
TMTransaction_test.cpp
1#include <test/jtx/Env.h>
2#include <test/jtx/envconfig.h>
3#include <test/overlay/CapturePeer.h>
4
5#include <xrpl/beast/unit_test/suite.h>
6#include <xrpl/resource/Fees.h>
7
8#include <xrpl.pb.h>
9
10#include <memory>
11
12namespace xrpl::test {
13
14using namespace jtx;
15
17{
18 void
20 {
21 testcase("Undeserializable Transaction Is Charged");
22
23 Env env{*this, envconfig()};
24
25 auto peer = makeCapturePeer(env);
27 tx->set_status(protocol::tsNEW);
28
29 // Bytes that are not a serialized transaction, so deserialization fails.
30 tx->set_rawtransaction("\x01\x02\x03", 3);
31
32 peer->onMessage(tx);
33 BEAST_EXPECT(peer->feeCharge() == resource::kFeeInvalidData);
34 }
35
36 void
41};
42
43BEAST_DEFINE_TESTSUITE(TMTransaction, overlay, xrpl);
44
45} // namespace xrpl::test
A testsuite class.
Definition suite.h:52
TestcaseT testcase
Memberspace for declaring test cases.
Definition suite.h:155
void run() override
Runs the suite.
A transaction testing environment.
Definition Env.h:161
T make_shared(T... args)
Charge const kFeeInvalidData
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Definition envconfig.h:38
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
std::shared_ptr< PeerType > makeCapturePeer(jtx::Env &env, std::optional< PublicKey > key=std::nullopt, HttpRequestType request={})
Build an active CapturePeer and register it with the overlay.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5