Skip to content

Commit c0d1428

Browse files
Fix update checker version logic
1 parent 82a5339 commit c0d1428

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/qt/utilitydialog.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,15 @@ void UpdateWalletDialog::gotReply()
208208
newVersionRevision = responseObject[strVerRev].toInt();
209209
newVersionBuild = responseObject[strVerBuild].toInt();
210210
newVersionRC = responseObject[strVerRC].toInt();
211-
if (lastMandatory[strVerMajor].toInt() <= CLIENT_VERSION_MAJOR && lastMandatory[strVerMinor].toInt() <= CLIENT_VERSION_MINOR && lastMandatory[strVerRev].toInt() <= CLIENT_VERSION_REVISION && lastMandatory[strVerBuild].toInt() <= CLIENT_VERSION_BUILD) {
211+
if (lastMandatory[strVerMajor].toInt() < CLIENT_VERSION_MAJOR || (lastMandatory[strVerMajor].toInt() == CLIENT_VERSION_MAJOR && lastMandatory[strVerMinor].toInt() < CLIENT_VERSION_MINOR) ||
212+
(lastMandatory[strVerMajor].toInt() == CLIENT_VERSION_MAJOR && lastMandatory[strVerMinor].toInt() == CLIENT_VERSION_MINOR && lastMandatory[strVerRev].toInt() < CLIENT_VERSION_REVISION) ||
213+
(lastMandatory[strVerMajor].toInt() == CLIENT_VERSION_MAJOR && lastMandatory[strVerMinor].toInt() == CLIENT_VERSION_MINOR && lastMandatory[strVerRev].toInt() == CLIENT_VERSION_REVISION &&
214+
lastMandatory[strVerBuild].toInt() <= CLIENT_VERSION_BUILD)) {
212215
mandatoryUpdate = responseObject[strMandatory].toBool();
213-
if (newVersionMajor <= CLIENT_VERSION_MAJOR && newVersionMinor <= CLIENT_VERSION_MINOR && newVersionRevision <= CLIENT_VERSION_REVISION && newVersionBuild <= CLIENT_VERSION_BUILD) {
216+
if (newVersionMajor < CLIENT_VERSION_MAJOR || (newVersionMajor == CLIENT_VERSION_MAJOR && newVersionMinor < CLIENT_VERSION_MINOR) ||
217+
(newVersionMajor == CLIENT_VERSION_MAJOR && newVersionMinor == CLIENT_VERSION_MINOR && newVersionRevision < CLIENT_VERSION_REVISION) ||
218+
(newVersionMajor == CLIENT_VERSION_MAJOR && newVersionMinor == CLIENT_VERSION_MINOR && newVersionRevision == CLIENT_VERSION_REVISION &&
219+
newVersionBuild <= CLIENT_VERSION_BUILD)) {
214220
outdated = false;
215221
}
216222
}

src/qt/utilitydialog.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ class UpdateWalletDialog : public QDialog
5454
QNetworkAccessManager *manager = nullptr;
5555
QNetworkReply *reply = nullptr;
5656
bool mandatoryUpdate = false;
57-
unsigned int newVersionMajor = 0;
58-
unsigned int newVersionMinor = 0;
59-
unsigned int newVersionRevision = 0;
60-
unsigned int newVersionBuild = 0;
61-
unsigned int newVersionRC = 0;
57+
int newVersionMajor = 0;
58+
int newVersionMinor = 0;
59+
int newVersionRevision = 0;
60+
int newVersionBuild = 0;
61+
int newVersionRC = 0;
6262

6363
void gotReply();
6464
QString getUpdateString();

0 commit comments

Comments
 (0)