From 48227d4a07d149117e5c97785972b2aa953064c4 Mon Sep 17 00:00:00 2001 From: Yoshi Date: Sun, 15 Aug 2021 07:21:08 +0200 Subject: [PATCH] Refactor: Exported dandelion shuffle interval into external constant --- src/init.cpp | 2 +- src/net.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 171ad6af60..73e638e1d8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1818,7 +1818,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) CConnman* connman = node.connman.get(); node.scheduler->scheduleEvery([connman]{ connman->CheckDandelionShuffle(); - }, std::chrono::milliseconds{1000}); + }, CHECK_DANDELION_SHUFFLE_INTERVAL); #if HAVE_SYSTEM StartupNotify(args); diff --git a/src/net.h b/src/net.h index 1a81ccb66e..dfcfc8e028 100644 --- a/src/net.h +++ b/src/net.h @@ -87,6 +87,7 @@ static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000; static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000; typedef std::chrono::seconds sec; +typedef std::chrono::milliseconds msec; /** Maximum number of outbound peers designated as Dandelion destinations */ static const int DANDELION_MAX_DESTINATIONS = 2; @@ -96,6 +97,8 @@ static const sec DANDELION_SHUFFLE_INTERVAL = sec(600); static const sec DANDELION_EMBARGO_MINIMUM = sec(10); /** The average additional embargo time beyond the minimum amount */ static const sec DANDELION_EMBARGO_AVG_ADD = sec(20); +/** The time to wait for the scheduler before rerunning Dandelion shuffle check */ +static const msec CHECK_DANDELION_SHUFFLE_INTERVAL = msec(1000); typedef int64_t NodeId;