Menu: remove 'Change restore height'

Restoring the wallet from seed is the preferred UX here. Missing
transactions should be imported using Tools -> Import transaction.
This commit is contained in:
tobtoht 2022-06-23 12:53:52 +02:00
parent 840d6a2b02
commit 08acac91f6
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
7 changed files with 0 additions and 115 deletions

View file

@ -253,7 +253,6 @@ void MainWindow::initMenu() {
connect(ui->actionRefresh_tabs, &QAction::triggered, [this]{m_ctx->refreshModels();});
connect(ui->actionRescan_spent, &QAction::triggered, this, &MainWindow::rescanSpent);
connect(ui->actionWallet_cache_debug, &QAction::triggered, this, &MainWindow::showWalletCacheDebugDialog);
connect(ui->actionChange_restore_height, &QAction::triggered, this, &MainWindow::showRestoreHeightDialog);
// [Wallet] -> [Advanced] -> [Export]
connect(ui->actionExportOutputs, &QAction::triggered, this, &MainWindow::exportOutputs);
@ -394,7 +393,6 @@ void MainWindow::initWalletContext() {
connect(m_ctx.get(), &AppContext::deviceButtonPressed, this, &MainWindow::onDeviceButtonPressed);
connect(m_ctx.get(), &AppContext::initiateTransaction, this, &MainWindow::onInitiateTransaction);
connect(m_ctx.get(), &AppContext::endTransaction, this, &MainWindow::onEndTransaction);
connect(m_ctx.get(), &AppContext::customRestoreHeightSet, this, &MainWindow::onCustomRestoreHeightSet);
connect(m_ctx.get(), &AppContext::keysCorrupted, this, &MainWindow::onKeysCorrupted);
connect(m_ctx.get(), &AppContext::selectedInputsChanged, this, &MainWindow::onSelectedInputsChanged);
@ -787,22 +785,6 @@ void MainWindow::updatePasswordIcon() {
m_statusBtnPassword->setIcon(icon);
}
void MainWindow::showRestoreHeightDialog() {
// settings custom restore height is only available for 25 word seeds
auto seedLength = m_ctx->wallet->seedLength();
if (seedLength == 14 || seedLength == 16) { // TODO: update this warning (import tx, delete cache, restore from seed)
const auto msg = "This wallet has a mnemonic seed with an embedded restore height.";
QMessageBox::warning(this, "Cannot set custom restore height", msg);
return;
}
RestoreHeightDialog dialog{this, m_ctx->wallet->getWalletCreationHeight()};
if (dialog.exec() == QDialog::Accepted) {
int restoreHeight = dialog.getHeight();
m_ctx->onSetRestoreHeight(restoreHeight);
}
}
void MainWindow::showKeysDialog() {
if (!this->verifyPassword()) {
return;
@ -1445,13 +1427,6 @@ void MainWindow::onEndTransaction() {
}
}
void MainWindow::onCustomRestoreHeightSet(int height) {
auto msg = QString("The restore height for this wallet has been set to %1. "
"Please re-open the wallet. Feather will now quit.").arg(height);
QMessageBox::information(this, "Cannot set custom restore height", msg);
this->menuQuitClicked();
}
void MainWindow::onKeysCorrupted() {
if (!m_criticalWarningShown) {
m_criticalWarningShown = true;

View file

@ -20,7 +20,6 @@
#include "dialog/PasswordChangeDialog.h"
#include "dialog/KeysDialog.h"
#include "dialog/AboutDialog.h"
#include "dialog/RestoreHeightDialog.h"
#include "dialog/SplashDialog.h"
#include "libwalletqt/Wallet.h"
#include "model/SubaddressModel.h"
@ -138,7 +137,6 @@ private slots:
void onSignedHashesReceived(QNetworkReply *reply, const QString &platformTag, const QString &version);
void onInitiateTransaction();
void onEndTransaction();
void onCustomRestoreHeightSet(int height);
void onKeysCorrupted();
void onSelectedInputsChanged(const QStringList &selectedInputs);
@ -173,7 +171,6 @@ private slots:
void onViewOnBlockExplorer(const QString &txid);
void onResendTransaction(const QString &txid);
void importContacts();
void showRestoreHeightDialog();
void importTransaction();
void onDeviceError(const QString &error);
void onDeviceButtonRequest(quint64 code);

View file

@ -476,7 +476,6 @@
<addaction name="actionRescan_spent"/>
<addaction name="actionWallet_cache_debug"/>
<addaction name="separator"/>
<addaction name="actionChange_restore_height"/>
<addaction name="menuExport"/>
<addaction name="menuImport"/>
</widget>

View file

@ -199,24 +199,6 @@ void AppContext::onTorSettingsChanged() {
qDebug() << "Changed privacyLevel to " << privacyLevel;
}
void AppContext::onSetRestoreHeight(quint64 height){
auto seedLength = this->wallet->seedLength();
if (seedLength == 14 || seedLength == 16) {
const auto msg = "This wallet has a mnemonic seed with an embedded restore height.";
emit setRestoreHeightError(msg);
return;
}
this->wallet->setWalletCreationHeight(height);
this->wallet->setPassword(this->wallet->getPassword()); // trigger .keys write
// nuke wallet cache
const auto fn = this->wallet->cachePath();
WalletManager::clearWalletCache(fn);
emit customRestoreHeightSet(height);
}
void AppContext::stopTimers() {
m_storeTimer.stop();
}

View file

@ -57,7 +57,6 @@ public slots:
void onCancelTransaction(PendingTransaction *tx, const QVector<QString> &address);
void onSweepOutputs(const QVector<QString> &keyImages, QString address, bool churn, int outputs);
void onCreateTransactionError(const QString &msg);
void onSetRestoreHeight(quint64 height);
void onMultiBroadcast(PendingTransaction *tx);
void onDeviceButtonRequest(quint64 code);
void onDeviceButtonPressed();
@ -87,8 +86,6 @@ signals:
void createTransactionError(QString message);
void createTransactionCancelled(const QVector<QString> &address, quint64 amount);
void createTransactionSuccess(PendingTransaction *tx, const QVector<QString> &address);
void setRestoreHeightError(const QString &msg);
void customRestoreHeightSet(int height);
void initiateTransaction();
void endTransaction();
void deviceButtonRequest(quint64 code);

View file

@ -1,40 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
#include "RestoreHeightDialog.h"
#include <QLabel>
#include <QVBoxLayout>
#include <QDialogButtonBox>
RestoreHeightDialog::RestoreHeightDialog(QWidget *parent, quint64 currentRestoreHeight)
: WindowModalDialog(parent)
, m_restoreHeightWidget(new RestoreHeightWidget(this))
{
auto *layout = new QVBoxLayout(this);
auto *label = new QLabel(this);
label->setText("Enter a wallet creation date or restore height.");
auto *buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
layout->addWidget(label);
layout->addWidget(m_restoreHeightWidget);
layout->addWidget(buttonBox);
this->setLayout(layout);
if (currentRestoreHeight) {
m_restoreHeightWidget->setHeight(currentRestoreHeight);
}
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
this->adjustSize();
}
int RestoreHeightDialog::getHeight() {
return m_restoreHeightWidget->getHeight();
}

View file

@ -1,25 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
#ifndef FEATHER_RESTOREHEIGHTDIALOG_H
#define FEATHER_RESTOREHEIGHTDIALOG_H
#include <QDialog>
#include "components.h"
#include "widgets/RestoreHeightWidget.h"
class RestoreHeightDialog : public WindowModalDialog
{
Q_OBJECT
public:
explicit RestoreHeightDialog(QWidget *parent = nullptr, quint64 currentRestoreHeight = 0);
int getHeight();
private:
RestoreHeightWidget *m_restoreHeightWidget;
};
#endif //FEATHER_RESTOREHEIGHTDIALOG_H