Warn on replay of ledgers from before Jan 1 2018

This commit is contained in:
Scott Schurr
2019-12-05 18:18:22 -08:00
committed by Manoj doshi
parent 51ed7db002
commit f7fffee28d
2 changed files with 35 additions and 0 deletions

View File

@@ -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()) << JLOG(m_journal.info()) <<
"Loading ledger " << loadLedger->info().hash << "Loading ledger " << loadLedger->info().hash <<

View File

@@ -46,6 +46,27 @@ namespace ripple {
namespace detail { 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 class FeatureCollections
{ {
static constexpr char const* const featureNames[] = static constexpr char const* const featureNames[] =