From ddc2bbf7425feb738441c01529ab7ba692e18a74 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Wed, 19 Feb 2020 15:40:34 +0000 Subject: [PATCH] Revert "Add -maxtimeadjustment with default of 0 instead of the 4200 seconds used in Bitcoin Core." This reverts commit eb5e328073ced7c867de99d6385a9d5f142e1ce0. Signed-off-by: Daira Hopwood --- src/init.cpp | 7 ------- src/timedata.cpp | 2 +- src/timedata.h | 10 ---------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 39065a88d..c34eef50e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -32,7 +32,6 @@ #include "script/standard.h" #include "script/sigcache.h" #include "scheduler.h" -#include "timedata.h" #include "txdb.h" #include "torcontrol.h" #include "ui_interface.h" @@ -356,7 +355,6 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-dbcache=", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache)); strUsage += HelpMessageOpt("-loadblock=", _("Imports blocks from external blk000??.dat file on startup")); strUsage += HelpMessageOpt("-maxorphantx=", strprintf(_("Keep at most unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS)); - strUsage += HelpMessageOpt("-maxtimeadjustment=", strprintf(_("Maximum allowed median peer time offset adjustment, in seconds. Local perspective of time may be influenced by peers forward or backward by this amount. (default: %u seconds, maximum: %u seconds)"), DEFAULT_MAX_TIME_ADJUSTMENT, LIMIT_MAX_TIME_ADJUSTMENT)); strUsage += HelpMessageOpt("-par=", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"), -GetNumCores(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS)); #ifndef WIN32 @@ -983,11 +981,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) fPruneMode = true; } - int64_t nMaxTimeAdjustment = GetArg("-maxtimeadjustment", DEFAULT_MAX_TIME_ADJUSTMENT); - if (nMaxTimeAdjustment < 0 || nMaxTimeAdjustment > LIMIT_MAX_TIME_ADJUSTMENT) { - return InitError(strprintf(_("-maxtimeadjustment must be in the range 0 to %u seconds"), LIMIT_MAX_TIME_ADJUSTMENT)); - } - RegisterAllCoreRPCCommands(tableRPC); #ifdef ENABLE_WALLET bool fDisableWallet = GetBoolArg("-disablewallet", false); diff --git a/src/timedata.cpp b/src/timedata.cpp index 0cb967726..4bd9f47ce 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -80,7 +80,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample) int64_t nMedian = vTimeOffsets.median(); std::vector vSorted = vTimeOffsets.sorted(); // Only let other nodes change our time by so much - if (abs64(nMedian) <= GetArg("-maxtimeadjustment", DEFAULT_MAX_TIME_ADJUSTMENT)) + if (abs64(nMedian) < 70 * 60) { nTimeOffset = nMedian; } diff --git a/src/timedata.h b/src/timedata.h index 3e660d7e5..69a1eb0f6 100644 --- a/src/timedata.h +++ b/src/timedata.h @@ -10,16 +10,6 @@ #include #include -#include "chain.h" - -static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT = 0; -static const int64_t LIMIT_MAX_TIME_ADJUSTMENT = 25 * 60; - -static_assert(LIMIT_MAX_TIME_ADJUSTMENT * 2 < MAX_FUTURE_BLOCK_TIME_MTP, - "LIMIT_MAX_TIME_ADJUSTMENT is too high given MAX_FUTURE_BLOCK_TIME_MTP"); -static_assert(MAX_FUTURE_BLOCK_TIME_MTP + LIMIT_MAX_TIME_ADJUSTMENT < MAX_FUTURE_BLOCK_TIME_ADJUSTED, - "LIMIT_MAX_TIME_ADJUSTMENT is too high given MAX_FUTURE_BLOCK_TIME_MTP and MAX_FUTURE_BLOCK_TIME_ADJUSTED"); - class CNetAddr; /**