From f7fffee28d7ac6d33cf7e4575d9ea915ebe4f196 Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Thu, 5 Dec 2019 18:18:22 -0800 Subject: [PATCH] Warn on replay of ledgers from before Jan 1 2018 --- src/ripple/app/main/Application.cpp | 14 ++++++++++++++ src/ripple/protocol/Feature.h | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index a499845e9..377f37e78 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -1987,6 +1987,20 @@ bool ApplicationImp::loadOldLedger ( } } } + using namespace std::chrono_literals; + using namespace date; + static constexpr NetClock::time_point ledgerWarnTimePoint{ + sys_days{January/1/2018} - sys_days{January/1/2000}}; + if (loadLedger->info().closeTime < ledgerWarnTimePoint) + { + JLOG(m_journal.fatal()) << + "\n\n*** WARNING ***\n" + "You are replaying a ledger from before " << + to_string(ledgerWarnTimePoint) << " UTC.\n" + "This replay will not handle your ledger as it was originally " + "handled.\nConsider running an earlier version of rippled to " + "get the older rules.\n*** CONTINUING ***\n"; + } JLOG(m_journal.info()) << "Loading ledger " << loadLedger->info().hash << diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index 4a397dbe6..e3b70d82d 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -46,6 +46,27 @@ namespace ripple { namespace detail { +// *NOTE* +// +// Features, or Amendments as they are called elsewhere, are enabled on the +// network at some specific time based on Validator voting. Features are +// enabled using run-time conditionals based on the state of the amendment. +// There is value in retaining that conditional code for some time after +// the amendment is enabled to make it simple to replay old transactions. +// However, once an Amendment has been enabled for, say, more than two years +// then retaining that conditional code has less value since it is +// uncommon to replay such old transactions. +// +// Starting in January of 2020 Amendment conditionals from before January +// 2018 are being removed. So replaying any ledger from before January +// 2018 needs to happen on an older version of the server code. There's +// a log message in Application.cpp that warns about replaying old ledgers. +// +// At some point in the future someone may wish to remove Amendment +// conditional code for Amendments that were enabled after January 2018. +// When that happens then the log message in Application.cpp should be +// updated. + class FeatureCollections { static constexpr char const* const featureNames[] =