mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge #18289: refactor: Make scheduler methods type safe
fa36f3a295refactor: move DUMP_BANS_INTERVAL to banman.h (MarcoFalke)fadafb83cfscheduler: Make schedule* methods type safe (MarcoFalke)fa70ccc6c4scheduler: Use C++11 member initialization, add shutdown assert (MarcoFalke) Pull request description: Main benefit is that stuff like `15 * 60 * 1000` is replaced by `minutes{15}` ACKs for top commit: vasild: ACKfa36f3a(code review, not tested) ajtowns: ACKfa36f3a295jonatack: ACKfa36f3aTree-SHA512: f35f1a1d643dfa676bd47474659f6492ed05cca04cdb556064b126f654a6a44a4b93fcaddcdcd41faf81b8f11439c11e5c7ab88685ba2eef12f7188843d17ad8
This commit is contained in:
@@ -86,10 +86,6 @@ static const bool DEFAULT_PROXYRANDOMIZE = true;
|
||||
static const bool DEFAULT_REST_ENABLE = false;
|
||||
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
|
||||
|
||||
// Dump addresses to banlist.dat every 15 minutes (900s)
|
||||
static constexpr int DUMP_BANS_INTERVAL = 60 * 15;
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
|
||||
// accessing block files don't count towards the fd_set size limit
|
||||
@@ -1278,7 +1274,7 @@ bool AppInitMain(NodeContext& node)
|
||||
// Gather some entropy once per minute.
|
||||
node.scheduler->scheduleEvery([]{
|
||||
RandAddPeriodic();
|
||||
}, 60000);
|
||||
}, std::chrono::minutes{1});
|
||||
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(*node.scheduler);
|
||||
|
||||
@@ -1862,7 +1858,7 @@ bool AppInitMain(NodeContext& node)
|
||||
BanMan* banman = node.banman.get();
|
||||
node.scheduler->scheduleEvery([banman]{
|
||||
banman->DumpBanlist();
|
||||
}, DUMP_BANS_INTERVAL * 1000);
|
||||
}, DUMP_BANS_INTERVAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user