Bitcoin Core 30.99.0
P2P Digital Currency
logging_tests.cpp
Go to the documentation of this file.
1// Copyright (c) 2019-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <init/common.h>
6#include <logging.h>
7#include <logging/timer.h>
8#include <scheduler.h>
9#include <test/util/logging.h>
11#include <tinyformat.h>
12#include <util/fs.h>
13#include <util/fs_helpers.h>
14#include <util/string.h>
15
16#include <chrono>
17#include <fstream>
18#include <future>
19#include <ios>
20#include <iostream>
21#include <source_location>
22#include <string>
23#include <unordered_map>
24#include <utility>
25#include <vector>
26
27#include <boost/test/unit_test.hpp>
28
31
33
34static void ResetLogger()
35{
38}
39
40static std::vector<std::string> ReadDebugLogLines()
41{
42 std::vector<std::string> lines;
43 std::ifstream ifs{LogInstance().m_file_path.std_path()};
44 for (std::string line; std::getline(ifs, line);) {
45 lines.push_back(std::move(line));
46 }
47 return lines;
48}
49
50struct LogSetup : public BasicTestingSetup {
51 fs::path prev_log_path;
52 fs::path tmp_log_path;
58 std::unordered_map<BCLog::LogFlags, BCLog::Level> prev_category_levels;
61
63 tmp_log_path{m_args.GetDataDirBase() / "tmp_debug.log"},
64 prev_reopen_file{LogInstance().m_reopen_file},
65 prev_print_to_file{LogInstance().m_print_to_file},
66 prev_log_timestamps{LogInstance().m_log_timestamps},
67 prev_log_threadnames{LogInstance().m_log_threadnames},
68 prev_log_sourcelocations{LogInstance().m_log_sourcelocations},
69 prev_category_levels{LogInstance().CategoryLevels()},
71 prev_category_mask{LogInstance().GetCategoryMask()}
72 {
78
79 // Prevent tests from failing when the line number of the logs changes.
81
86 }
87
89 {
91 LogInfo("Sentinel log to reopen log file");
102 }
103};
104
106{
107 auto micro_timer = BCLog::Timer<std::chrono::microseconds>("tests", "end_msg");
108 const std::string_view result_prefix{"tests: msg ("};
109 BOOST_CHECK_EQUAL(micro_timer.LogMsg("msg").substr(0, result_prefix.size()), result_prefix);
110}
111
113{
115
116 struct Case {
117 std::string msg;
118 BCLog::LogFlags category;
119 BCLog::Level level;
120 std::string prefix;
121 SourceLocation loc;
122 };
123
124 std::vector<Case> cases = {
125 {"foo1: bar1", BCLog::NET, BCLog::Level::Debug, "[net] ", SourceLocation{__func__}},
126 {"foo2: bar2", BCLog::NET, BCLog::Level::Info, "[net:info] ", SourceLocation{__func__}},
127 {"foo3: bar3", BCLog::ALL, BCLog::Level::Debug, "[debug] ", SourceLocation{__func__}},
128 {"foo4: bar4", BCLog::ALL, BCLog::Level::Info, "", SourceLocation{__func__}},
129 {"foo5: bar5", BCLog::NONE, BCLog::Level::Debug, "[debug] ", SourceLocation{__func__}},
130 {"foo6: bar6", BCLog::NONE, BCLog::Level::Info, "", SourceLocation{__func__}},
131 };
132
133 std::vector<std::string> expected;
134 for (auto& [msg, category, level, prefix, loc] : cases) {
135 expected.push_back(tfm::format("[%s:%s] [%s] %s%s", util::RemovePrefix(loc.file_name(), "./"), loc.line(), loc.function_name_short(), prefix, msg));
136 LogInstance().LogPrintStr(msg, std::move(loc), category, level, /*should_ratelimit=*/false);
137 }
138 std::vector<std::string> log_lines{ReadDebugLogLines()};
139 BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
140}
141
142BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacros, LogSetup)
143{
145 LogTrace(BCLog::NET, "foo6: %s", "bar6"); // not logged
146 LogDebug(BCLog::NET, "foo7: %s", "bar7");
147 LogInfo("foo8: %s", "bar8");
148 LogWarning("foo9: %s", "bar9");
149 LogError("foo10: %s", "bar10");
150 std::vector<std::string> log_lines{ReadDebugLogLines()};
151 std::vector<std::string> expected = {
152 "[net] foo7: bar7",
153 "foo8: bar8",
154 "[warning] foo9: bar9",
155 "[error] foo10: bar10",
156 };
157 BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
158}
159
160BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacros_CategoryName, LogSetup)
161{
163 const auto concatenated_category_names = LogInstance().LogCategoriesString();
164 std::vector<std::pair<BCLog::LogFlags, std::string>> expected_category_names;
165 const auto category_names = SplitString(concatenated_category_names, ',');
166 for (const auto& category_name : category_names) {
167 BCLog::LogFlags category;
168 const auto trimmed_category_name = TrimString(category_name);
169 BOOST_REQUIRE(GetLogCategory(category, trimmed_category_name));
170 expected_category_names.emplace_back(category, trimmed_category_name);
171 }
172
173 std::vector<std::string> expected;
174 for (const auto& [category, name] : expected_category_names) {
175 LogDebug(category, "foo: %s\n", "bar");
176 std::string expected_log = "[";
177 expected_log += name;
178 expected_log += "] foo: bar";
179 expected.push_back(expected_log);
180 }
181
182 std::vector<std::string> log_lines{ReadDebugLogLines()};
183 BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
184}
185
186BOOST_FIXTURE_TEST_CASE(logging_SeverityLevels, LogSetup)
187{
190 LogInstance().SetCategoryLogLevel(/*category_str=*/"net", /*level_str=*/"info");
191
192 // Global log level
193 LogInfo("info_%s", 1);
194 LogTrace(BCLog::HTTP, "trace_%s. This log level is lower than the global one.", 2);
195 LogDebug(BCLog::HTTP, "debug_%s", 3);
196 LogWarning("warn_%s", 4);
197 LogError("err_%s", 5);
198
199 // Category-specific log level
200 LogDebug(BCLog::NET, "debug_%s. This log level is the same as the global one but lower than the category-specific one, which takes precedence.", 6);
201
202 std::vector<std::string> expected = {
203 "info_1",
204 "[http] debug_3",
205 "[warning] warn_4",
206 "[error] err_5",
207 };
208 std::vector<std::string> log_lines{ReadDebugLogLines()};
209 BOOST_CHECK_EQUAL_COLLECTIONS(log_lines.begin(), log_lines.end(), expected.begin(), expected.end());
210}
211
213{
214 // Set global log level
215 {
216 ResetLogger();
219 const char* argv_test[] = {"bitcoind", "-loglevel=debug"};
220 std::string err;
221 BOOST_REQUIRE(args.ParseParameters(2, argv_test, err));
222
223 auto result = init::SetLoggingLevel(args);
224 BOOST_REQUIRE(result);
226 }
227
228 // Set category-specific log level
229 {
230 ResetLogger();
233 const char* argv_test[] = {"bitcoind", "-loglevel=net:trace"};
234 std::string err;
235 BOOST_REQUIRE(args.ParseParameters(2, argv_test, err));
236
237 auto result = init::SetLoggingLevel(args);
238 BOOST_REQUIRE(result);
240
241 const auto& category_levels{LogInstance().CategoryLevels()};
242 const auto net_it{category_levels.find(BCLog::LogFlags::NET)};
243 BOOST_REQUIRE(net_it != category_levels.end());
244 BOOST_CHECK_EQUAL(net_it->second, BCLog::Level::Trace);
245 }
246
247 // Set both global log level and category-specific log level
248 {
249 ResetLogger();
252 const char* argv_test[] = {"bitcoind", "-loglevel=debug", "-loglevel=net:trace", "-loglevel=http:info"};
253 std::string err;
254 BOOST_REQUIRE(args.ParseParameters(4, argv_test, err));
255
256 auto result = init::SetLoggingLevel(args);
257 BOOST_REQUIRE(result);
259
260 const auto& category_levels{LogInstance().CategoryLevels()};
261 BOOST_CHECK_EQUAL(category_levels.size(), 2);
262
263 const auto net_it{category_levels.find(BCLog::LogFlags::NET)};
264 BOOST_CHECK(net_it != category_levels.end());
265 BOOST_CHECK_EQUAL(net_it->second, BCLog::Level::Trace);
266
267 const auto http_it{category_levels.find(BCLog::LogFlags::HTTP)};
268 BOOST_CHECK(http_it != category_levels.end());
269 BOOST_CHECK_EQUAL(http_it->second, BCLog::Level::Info);
270 }
271}
272
275
277 {
278 scheduler.m_service_thread = std::thread([this] { scheduler.serviceQueue(); });
279 }
281 {
282 scheduler.stop();
283 }
284 void MockForwardAndSync(std::chrono::seconds duration)
285 {
286 scheduler.MockForward(duration);
287 std::promise<void> promise;
288 scheduler.scheduleFromNow([&promise] { promise.set_value(); }, 0ms);
289 promise.get_future().wait();
290 }
291 std::shared_ptr<BCLog::LogRateLimiter> GetLimiter(size_t max_bytes, std::chrono::seconds window)
292 {
293 auto sched_func = [this](auto func, auto w) {
294 scheduler.scheduleEvery(std::move(func), w);
295 };
296 return BCLog::LogRateLimiter::Create(sched_func, max_bytes, window);
297 }
298};
299
300BOOST_AUTO_TEST_CASE(logging_log_rate_limiter)
301{
302 uint64_t max_bytes{1024};
303 auto reset_window{1min};
304 ScopedScheduler scheduler{};
305 auto limiter_{scheduler.GetLimiter(max_bytes, reset_window)};
306 auto& limiter{*Assert(limiter_)};
307
308 using Status = BCLog::LogRateLimiter::Status;
309 auto source_loc_1{SourceLocation{__func__}};
310 auto source_loc_2{SourceLocation{__func__}};
311
312 // A fresh limiter should not have any suppressions
313 BOOST_CHECK(!limiter.SuppressionsActive());
314
315 // Resetting an unused limiter is fine
316 limiter.Reset();
317 BOOST_CHECK(!limiter.SuppressionsActive());
318
319 // No suppression should happen until more than max_bytes have been consumed
320 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_1, std::string(max_bytes - 1, 'a')), Status::UNSUPPRESSED);
321 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_1, "a"), Status::UNSUPPRESSED);
322 BOOST_CHECK(!limiter.SuppressionsActive());
323 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_1, "a"), Status::NEWLY_SUPPRESSED);
324 BOOST_CHECK(limiter.SuppressionsActive());
325 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_1, "a"), Status::STILL_SUPPRESSED);
326 BOOST_CHECK(limiter.SuppressionsActive());
327
328 // Location 2 should not be affected by location 1's suppression
329 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_2, std::string(max_bytes, 'a')), Status::UNSUPPRESSED);
330 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_2, "a"), Status::NEWLY_SUPPRESSED);
331 BOOST_CHECK(limiter.SuppressionsActive());
332
333 // After reset_window time has passed, all suppressions should be cleared.
334 scheduler.MockForwardAndSync(reset_window);
335
336 BOOST_CHECK(!limiter.SuppressionsActive());
337 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_1, std::string(max_bytes, 'a')), Status::UNSUPPRESSED);
338 BOOST_CHECK_EQUAL(limiter.Consume(source_loc_2, std::string(max_bytes, 'a')), Status::UNSUPPRESSED);
339}
340
341BOOST_AUTO_TEST_CASE(logging_log_limit_stats)
342{
344
345 // Check that stats gets initialized correctly.
347 BOOST_CHECK_EQUAL(stats.m_dropped_bytes, uint64_t{0});
348
349 const uint64_t MESSAGE_SIZE{BCLog::RATELIMIT_MAX_BYTES / 2};
350 BOOST_CHECK(stats.Consume(MESSAGE_SIZE));
352 BOOST_CHECK_EQUAL(stats.m_dropped_bytes, uint64_t{0});
353
354 BOOST_CHECK(stats.Consume(MESSAGE_SIZE));
356 BOOST_CHECK_EQUAL(stats.m_dropped_bytes, uint64_t{0});
357
358 // Consuming more bytes after already having consumed RATELIMIT_MAX_BYTES should fail.
359 BOOST_CHECK(!stats.Consume(500));
360 BOOST_CHECK_EQUAL(stats.m_available_bytes, uint64_t{0});
361 BOOST_CHECK_EQUAL(stats.m_dropped_bytes, uint64_t{500});
362}
363
364namespace {
365
366enum class Location {
367 INFO_1,
368 INFO_2,
369 DEBUG_LOG,
370 INFO_NOLIMIT,
371};
372
373void LogFromLocation(Location location, const std::string& message) {
374 switch (location) {
375 case Location::INFO_1:
376 LogInfo("%s\n", message);
377 return;
378 case Location::INFO_2:
379 LogInfo("%s\n", message);
380 return;
381 case Location::DEBUG_LOG:
382 LogDebug(BCLog::LogFlags::HTTP, "%s\n", message);
383 return;
384 case Location::INFO_NOLIMIT:
385 LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Info, /*should_ratelimit=*/false, "%s\n", message);
386 return;
387 } // no default case, so the compiler can warn about missing cases
388 assert(false);
389}
390
395void TestLogFromLocation(Location location, const std::string& message,
396 BCLog::LogRateLimiter::Status status, bool suppressions_active,
397 std::source_location source = std::source_location::current())
398{
399 BOOST_TEST_INFO_SCOPE("TestLogFromLocation called from " << source.file_name() << ":" << source.line());
400 using Status = BCLog::LogRateLimiter::Status;
401 if (!suppressions_active) assert(status == Status::UNSUPPRESSED); // developer error
402
403 std::ofstream ofs(LogInstance().m_file_path.std_path(), std::ios::out | std::ios::trunc); // clear debug log
404 LogFromLocation(location, message);
405 auto log_lines{ReadDebugLogLines()};
406 BOOST_TEST_INFO_SCOPE(log_lines.size() << " log_lines read: \n" << util::Join(log_lines, "\n"));
407
408 if (status == Status::STILL_SUPPRESSED) {
409 BOOST_CHECK_EQUAL(log_lines.size(), 0);
410 return;
411 }
412
413 if (status == Status::NEWLY_SUPPRESSED) {
414 BOOST_REQUIRE_EQUAL(log_lines.size(), 2);
415 BOOST_CHECK(log_lines[0].starts_with("[*] [warning] Excessive logging detected"));
416 log_lines.erase(log_lines.begin());
417 }
418 BOOST_REQUIRE_EQUAL(log_lines.size(), 1);
419 auto& payload{log_lines.back()};
420 BOOST_CHECK_EQUAL(suppressions_active, payload.starts_with("[*]"));
421 BOOST_CHECK(payload.ends_with(message));
422}
423
424} // namespace
425
426BOOST_FIXTURE_TEST_CASE(logging_filesize_rate_limit, LogSetup)
427{
428 using Status = BCLog::LogRateLimiter::Status;
433
434 constexpr int64_t line_length{1024};
435 constexpr int64_t num_lines{10};
436 constexpr int64_t bytes_quota{line_length * num_lines};
437 constexpr auto time_window{1h};
438
439 ScopedScheduler scheduler{};
440 auto limiter{scheduler.GetLimiter(bytes_quota, time_window)};
441 LogInstance().SetRateLimiting(limiter);
442
443 const std::string log_message(line_length - 1, 'a'); // subtract one for newline
444
445 for (int i = 0; i < num_lines; ++i) {
446 TestLogFromLocation(Location::INFO_1, log_message, Status::UNSUPPRESSED, /*suppressions_active=*/false);
447 }
448 TestLogFromLocation(Location::INFO_1, "a", Status::NEWLY_SUPPRESSED, /*suppressions_active=*/true);
449 TestLogFromLocation(Location::INFO_1, "b", Status::STILL_SUPPRESSED, /*suppressions_active=*/true);
450 TestLogFromLocation(Location::INFO_2, "c", Status::UNSUPPRESSED, /*suppressions_active=*/true);
451 {
452 scheduler.MockForwardAndSync(time_window);
453 BOOST_CHECK(ReadDebugLogLines().back().starts_with("[warning] Restarting logging"));
454 }
455 // Check that logging from previously suppressed location is unsuppressed again.
456 TestLogFromLocation(Location::INFO_1, log_message, Status::UNSUPPRESSED, /*suppressions_active=*/false);
457 // Check that conditional logging, and unconditional logging with should_ratelimit=false is
458 // not being ratelimited.
459 for (Location location : {Location::DEBUG_LOG, Location::INFO_NOLIMIT}) {
460 for (int i = 0; i < num_lines + 2; ++i) {
461 TestLogFromLocation(location, log_message, Status::UNSUPPRESSED, /*suppressions_active=*/false);
462 }
463 }
464}
465
ArgsManager & args
Definition: bitcoind.cpp:277
#define Assert(val)
Identity function.
Definition: check.h:113
@ ALLOW_ANY
disable validation
Definition: args.h:106
bool ParseParameters(int argc, const char *const argv[], std::string &error)
Definition: args.cpp:177
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
Definition: args.cpp:568
static std::shared_ptr< LogRateLimiter > Create(SchedulerFunction &&scheduler_func, uint64_t max_bytes, std::chrono::seconds reset_window)
Definition: logging.cpp:378
Status
Suppression status of a source log location.
Definition: logging.h:178
bool m_log_sourcelocations
Definition: logging.h:249
void SetCategoryLogLevel(const std::unordered_map< LogFlags, Level > &levels) EXCLUSIVE_LOCKS_REQUIRED(!m_cs)
Definition: logging.h:313
void SetLogLevel(Level level)
Definition: logging.h:326
fs::path m_file_path
Definition: logging.h:252
bool m_log_threadnames
Definition: logging.h:248
void SetRateLimiting(std::shared_ptr< LogRateLimiter > limiter) EXCLUSIVE_LOCKS_REQUIRED(!m_cs)
Definition: logging.h:292
void EnableCategory(LogFlags flag)
Definition: logging.cpp:123
bool m_log_timestamps
Definition: logging.h:246
std::atomic< bool > m_reopen_file
Definition: logging.h:253
bool m_print_to_file
Definition: logging.h:244
std::unordered_map< LogFlags, Level > CategoryLevels() const EXCLUSIVE_LOCKS_REQUIRED(!m_cs)
Definition: logging.h:308
void LogPrintStr(std::string_view str, SourceLocation &&source_loc, BCLog::LogFlags category, BCLog::Level level, bool should_ratelimit) EXCLUSIVE_LOCKS_REQUIRED(!m_cs)
Send a string to the log output.
Definition: logging.cpp:423
std::string LogCategoriesString() const
Returns a string with the log categories in alphabetical order.
Definition: logging.h:342
void DisableCategory(LogFlags flag)
Definition: logging.cpp:136
RAII-style object that outputs timing information to logs.
Definition: timer.h:24
Simple class for background tasks that should be run periodically or once "after a while".
Definition: scheduler.h:40
void MockForward(std::chrono::seconds delta_seconds) EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Mock the scheduler to fast forward in time.
Definition: scheduler.cpp:80
void serviceQueue() EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Services the queue 'forever'.
Definition: scheduler.cpp:23
void scheduleEvery(Function f, std::chrono::milliseconds delta) EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Repeat f until the scheduler is stopped.
Definition: scheduler.cpp:108
std::thread m_service_thread
Definition: scheduler.h:45
void stop() EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Tell any threads running serviceQueue to stop as soon as the current task is done.
Definition: scheduler.h:79
void scheduleFromNow(Function f, std::chrono::milliseconds delta) EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Call f once after the delta has passed.
Definition: scheduler.h:53
Like std::source_location, but allowing to override the function name.
Definition: logging.h:42
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
Common init functions shared by bitcoin-node, bitcoin-wallet, etc.
bool GetLogCategory(BCLog::LogFlags &flag, std::string_view str)
Return true if str parses as a log category and set the flag.
Definition: logging.cpp:219
BCLog::Logger & LogInstance()
Definition: logging.cpp:26
#define LogPrintLevel_(category, level, should_ratelimit,...)
Definition: logging.h:385
#define LogWarning(...)
Definition: logging.h:392
#define LogInfo(...)
Definition: logging.h:391
#define LogError(...)
Definition: logging.h:393
#define LogTrace(category,...)
Definition: logging.h:412
#define LogDebug(category,...)
Definition: logging.h:411
static std::vector< std::string > ReadDebugLogLines()
BOOST_FIXTURE_TEST_CASE(logging_LogPrintStr, LogSetup)
BOOST_AUTO_TEST_CASE(logging_timer)
static void ResetLogger()
Level
Definition: logging.h:121
constexpr uint64_t RATELIMIT_MAX_BYTES
Definition: logging.h:130
uint64_t CategoryMask
Definition: logging.h:84
constexpr auto DEFAULT_LOG_LEVEL
Definition: logging.h:128
LogFlags
Definition: logging.h:85
@ ALL
Definition: logging.h:119
@ HTTP
Definition: logging.h:90
@ NONE
Definition: logging.h:86
@ NET
Definition: logging.h:87
util::Result< void > SetLoggingLevel(const ArgsManager &args)
Definition: common.cpp:60
void format(std::ostream &out, FormatStringCheck< sizeof...(Args)> fmt, const Args &... args)
Format list of arguments to the stream according to given format string.
Definition: tinyformat.h:1079
std::vector< std::string > SplitString(std::string_view str, char sep)
Definition: string.h:148
std::string TrimString(std::string_view str, std::string_view pattern=" \f\n\r\t\v")
Definition: string.h:168
std::string RemovePrefix(std::string_view str, std::string_view prefix)
Definition: string.h:189
auto Join(const C &container, const S &separator, UnaryOp unary_op)
Join all container items.
Definition: string.h:204
#define BOOST_CHECK_EQUAL(v1, v2)
Definition: object.cpp:18
#define BOOST_CHECK(expr)
Definition: object.cpp:17
const char * prefix
Definition: rest.cpp:1142
const char * name
Definition: rest.cpp:48
const char * source
Definition: rpcconsole.cpp:62
Keeps track of an individual source location and how many available bytes are left for logging from i...
Definition: logging.h:139
uint64_t m_available_bytes
Remaining bytes.
Definition: logging.h:141
bool Consume(uint64_t bytes)
Updates internal accounting and returns true if enough available_bytes were remaining.
Definition: logging.cpp:572
uint64_t m_dropped_bytes
Number of bytes that were consumed but didn't fit in the available bytes.
Definition: logging.h:143
Basic testing setup.
Definition: setup_common.h:64
ArgsManager m_args
Test-specific arguments and settings.
Definition: setup_common.h:99
fs::path tmp_log_path
bool prev_reopen_file
fs::path prev_log_path
std::unordered_map< BCLog::LogFlags, BCLog::Level > prev_category_levels
bool prev_print_to_file
BCLog::Level prev_log_level
bool prev_log_threadnames
bool prev_log_sourcelocations
bool prev_log_timestamps
BCLog::CategoryMask prev_category_mask
std::shared_ptr< BCLog::LogRateLimiter > GetLimiter(size_t max_bytes, std::chrono::seconds window)
CScheduler scheduler
void MockForwardAndSync(std::chrono::seconds duration)
assert(!tx.IsCoinBase())