-
Notifications
You must be signed in to change notification settings - Fork 124
Rework Software Expiry #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 28.x-knots
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -53,6 +53,7 @@ | |||||||||
|
||||||||||
#include <QApplication> | ||||||||||
#include <QDebug> | ||||||||||
#include <QInputDialog> | ||||||||||
#include <QLatin1String> | ||||||||||
#include <QLibraryInfo> | ||||||||||
#include <QLocale> | ||||||||||
|
@@ -654,9 +655,23 @@ int GuiMain(int argc, char* argv[]) | |||||||||
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator); | ||||||||||
|
||||||||||
g_software_expiry = gArgs.GetIntArg("-softwareexpiry", DEFAULT_SOFTWARE_EXPIRY); | ||||||||||
if (IsThisSoftwareExpired(GetTime())) { | ||||||||||
QMessageBox::critical(nullptr, QObject::tr("Software expired"), QObject::tr("This software is expired, and may be out of consensus. You must choose to upgrade or override this expiration.")); | ||||||||||
return EXIT_FAILURE; | ||||||||||
if (IsThisSoftwareExpiringSoon(GetTime())) { | ||||||||||
QMessageBox::warning(nullptr, QObject::tr("Software expires soon"), QObject::tr("This software expires soon, and may fall out of consensus. You must choose to upgrade, or override this expiration with the 'softwareexpiry' option (Unix datetime, or 0 for no expiry).")); | ||||||||||
} else if (IsThisSoftwareExpired(GetTime())) { | ||||||||||
bool override_expiry_ok; | ||||||||||
QString override_expiry = QInputDialog::getText( | ||||||||||
nullptr, | ||||||||||
QObject::tr("Software Expired"), | ||||||||||
QObject::tr("This software is expired, and may be out of consensus.\nYou must choose to upgrade, or override this expiration by typing:\nI accept this software may be unsafe."), | ||||||||||
QLineEdit::Normal, | ||||||||||
"", | ||||||||||
&override_expiry_ok); | ||||||||||
if (!override_expiry_ok || override_expiry != QObject::tr("I accept this software may be unsafe.")) { | ||||||||||
return EXIT_FAILURE; | ||||||||||
} | ||||||||||
|
||||||||||
gArgs.ModifyRWConfigFile("softwareexpiry", "0"); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rwconf is kind of deprecated at this point (superceded by settings.json) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Line 196 in 5f82566
Line 1099 in 5f82566
Line 1090 in 5f82566
Line 1060 in 5f82566
Is there some other approach we want to take, or all good? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably shouldn't persist forever, and should reset to default if the user upgrades? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would we want to approach that? I think if we don't introduce an update detection mechanism, we have to go with The approach which springs to mind is adding an additional config value, like We could also generalize this with just a |
||||||||||
g_software_expiry = 0; | ||||||||||
} | ||||||||||
|
||||||||||
#ifdef ENABLE_WALLET | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4458,12 +4458,13 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio | |||||
if (IsThisSoftwareExpired(block.nTime)) { | ||||||
// Wait an extra day before we start rejecting blocks | ||||||
CBlockIndex const *blockindex_old = pindexPrev; | ||||||
for (int i = 0; i < 144; ++i) { | ||||||
for (int i = 0; i < std::min(144, pindexPrev->nHeight); ++i) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose it should be
Suggested change
? But to avoid re-calculating it every iteration, better to offset the starting index. |
||||||
assert(blockindex_old); | ||||||
blockindex_old = blockindex_old->pprev; | ||||||
} | ||||||
assert(blockindex_old); | ||||||
if (IsThisSoftwareExpired(blockindex_old->GetMedianTimePast())) { | ||||||
chainman.GetNotifications().fatalError(_("This software is expired, and may be out of consensus. You must choose to upgrade, or override this expiration with the 'softwareexpiry' option (Unix datetime, or 0 for no expiry).")); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe use |
||||||
return state.Invalid(BlockValidationResult::BLOCK_TIME_FUTURE, "node-expired", "node software has expired"); | ||||||
} | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably shouldn't pause startup waiting for a response