Skip to content

Commit

Permalink
Update to latest daemon sources
Browse files Browse the repository at this point in the history
* (MacOS) Replace mentions of "CryptoNote" with "Talleo" in bundle properties
* (Windows) Silence Winsock related warnings and add manifest to disable compatibility mode
* (Windows) Automatically update copyright years in resource file
* Add "Repair wallet" to "File" menu
* Only try to send optimization transactions if there is something to optimize, create them until no more optimizable outputs or node rejects due to exceeding limit
* Show path of currently opened wallet file in window title
* Use proper directory separators depending on operating system on "Recent wallets" menu and window title
  • Loading branch information
mtl1979 committed Feb 16, 2023
1 parent acbedbe commit 15d6bcb
Show file tree
Hide file tree
Showing 29 changed files with 199 additions and 20 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ file(GLOB_RECURSE FORMS src/Gui/*/*.ui)

if(MSVC)
include_directories(Platform/Windows)
set(SOURCES ${SOURCES} ${CMAKE_SOURCE_DIR}/Platform/Windows/ApplicationEventHandler.cpp)
configure_file(${CMAKE_SOURCE_DIR}/src/TalleoWallet.manifest.in ${CMAKE_BINARY_DIR}/TalleoWallet.manifest @ONLY)
set(SOURCES ${SOURCES} ${CMAKE_SOURCE_DIR}/Platform/Windows/ApplicationEventHandler.cpp ${CMAKE_BINARY_DIR}/TalleoWallet.manifest)
elseif(APPLE)
include_directories(Platform/OSX)
include_directories(Platform/Posix)
Expand All @@ -216,7 +217,7 @@ if (WIN32)
message(FATAL_ERROR "Only MSVC is supported on this platform")
endif ()

add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DSTATICLIB)
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DSTATICLIB)
include_directories(cryptonote/src/Platform/msc)

set(PLATFORM_DIR Windows)
Expand All @@ -231,9 +232,9 @@ elseif (UNIX)
file(GLOB_RECURSE OBJC_SOURCES src/*.mm)
set(SOURCES ${SOURCES} ${OBJC_SOURCES})
set(PLATFORM_DIR OSX)
set(MACOSX_BUNDLE_INFO_STRING "Cryptonote GUI wallet")
set(MACOSX_BUNDLE_INFO_STRING "Talleo GUI wallet")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}")
set(MACOSX_BUNDLE_BUNDLE_NAME CryptonoteWallet)
set(MACOSX_BUNDLE_BUNDLE_NAME TalleoWallet)
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "$${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}")

Expand Down
3 changes: 2 additions & 1 deletion CryptoNoteWallet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ set(CN_URI_SCHEME_NAME "talleo")
set(CN_VERSION_MAJOR "2")
set(CN_VERSION_MINOR "0")
set(CN_VERSION_REVISION "10")
set(CN_VERSION_BUILD "2")
set(CN_VERSION_BUILD "3")
set(CN_VERSION "${CN_VERSION_MAJOR}.${CN_VERSION_MINOR}.${CN_VERSION_REVISION}")
string(TIMESTAMP CN_BUILD_YEAR "%Y")
2 changes: 1 addition & 1 deletion cryptonote
Submodule cryptonote updated 42 files
+67 −31 .github/workflows/cmake.yml
+0 −2 external/miniupnpc/miniupnpc.c
+5 −1 external/rocksdb/monitoring/thread_status_util_debug.cc
+1 −0 include/INode.h
+2 −0 include/ITransfersContainer.h
+1 −0 include/IWallet.h
+0 −128 scripts/build-release.sh
+0 −16 scripts/easy_installer.sh
+0 −158 scripts/multi_installer.sh
+0 −16 scripts/nightly-build.sh
+40 −0 src/BinaryInfo/daemon.manifest.in
+40 −0 src/BinaryInfo/generate.manifest.in
+40 −0 src/BinaryInfo/miner.manifest.in
+40 −0 src/BinaryInfo/simplewallet.manifest.in
+40 −0 src/BinaryInfo/walletd.manifest.in
+10 −0 src/CMakeLists.txt
+10 −3 src/Common/Util.cpp
+3 −1 src/CryptoNoteCore/DatabaseBlockchainCache.cpp
+2 −0 src/CryptoNoteCore/Transaction.cpp
+2 −0 src/CryptoNoteCore/TransactionPrefixImpl.cpp
+9 −9 src/Miner/Miner.cpp
+2 −2 src/Miner/MinerManager.cpp
+7 −1 src/PaymentGate/PaymentServiceJsonRpcMessages.cpp
+11 −1 src/PaymentGate/PaymentServiceJsonRpcMessages.h
+5 −0 src/PaymentGate/PaymentServiceJsonRpcServer.cpp
+2 −1 src/PaymentGate/PaymentServiceJsonRpcServer.h
+29 −0 src/PaymentGate/WalletService.cpp
+2 −0 src/PaymentGate/WalletService.h
+5 −1 src/PaymentGateService/PaymentGateService.cpp
+4 −1 src/PaymentGateService/PaymentGateService.h
+2 −1 src/Platform/Linux/System/Dispatcher.cpp
+19 −5 src/SimpleWallet/SimpleWallet.cpp
+2 −0 src/SimpleWallet/SimpleWallet.h
+15 −12 src/SimpleWallet/Transfer.cpp
+4 −4 src/System/PortMapping.cpp
+1 −1 src/Transfers/BlockchainSynchronizer.cpp
+0 −4 src/Transfers/TransfersContainer.cpp
+2 −1 src/Transfers/TransfersContainer.h
+21 −1 src/Wallet/WalletGreen.cpp
+3 −2 src/Wallet/WalletGreen.h
+2 −1 src/version.cmake
+2 −2 src/version.h.in
3 changes: 3 additions & 0 deletions include/IWalletAdapter.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2015-2017, The Bytecoin developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -46,6 +47,7 @@ class IWalletAdapterObserver {
virtual ~IWalletAdapterObserver() {}
virtual void walletOpened() = 0;
virtual void walletOpenError(int _initStatus) = 0;
virtual void walletRepairStarted() = 0;
virtual void walletClosed() = 0;
virtual void passwordChanged() = 0;
virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) = 0;
Expand Down Expand Up @@ -82,6 +84,7 @@ class IWalletAdapter {
virtual WalletSaveStatus save(CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) = 0;
virtual WalletSaveStatus exportWallet(const QString& _path, bool _encrypt, CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) = 0;
virtual PasswordStatus changePassword(const QString& _oldPassword, const QString& _newPassword) = 0;
virtual void repair() = 0;
virtual void close() = 0;

virtual bool isOpen() const = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/Application/AddressBookManager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -394,6 +395,10 @@ void AddressBookManager::walletOpenError(int _initStatus) {
// Do nothing
}

void AddressBookManager::walletRepairStarted() {
// Do nothing
}

void AddressBookManager::walletClosed() {
m_addressIndexes.clear();
m_labelIndexes.clear();
Expand Down
2 changes: 2 additions & 0 deletions src/Application/AddressBookManager.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -71,6 +72,7 @@ class AddressBookManager : public QObject, public IAddressBookManager, public ID
// IWalletAdapterObserver
Q_SLOT virtual void walletOpened() override;
Q_SLOT virtual void walletOpenError(int _initStatus) override;
Q_SLOT virtual void walletRepairStarted() override;
Q_SLOT virtual void walletClosed() override;
Q_SLOT virtual void passwordChanged() override;
Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override;
Expand Down
13 changes: 11 additions & 2 deletions src/Application/OptimizationManager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand All @@ -17,6 +18,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.

#include <QApplication>
#include <QTime>
#include <QTimerEvent>

Expand Down Expand Up @@ -130,6 +132,10 @@ void OptimizationManager::walletOpenError(int _initStatus) {
// Do nothing
}

void OptimizationManager::walletRepairStarted() {
// Do nothing
}

void OptimizationManager::walletClosed() {
if (m_checkTimerId != -1) {
killTimer(m_checkTimerId);
Expand Down Expand Up @@ -223,8 +229,11 @@ void OptimizationManager::optimize() {
return;
}

walletAdapter->createFusionTransaction(Settings::instance().getOptimizationThreshold(),
Settings::instance().getOptimizationMixin(), walletAdapter->getAddress(0));
quint64 threshold = Settings::instance().getOptimizationThreshold();
while ((walletAdapter->getOutputsToOptimizeCount(threshold) > 0) &&
walletAdapter->createFusionTransaction(threshold, Settings::instance().getOptimizationMixin(), walletAdapter->getAddress(0))) {
qApp->processEvents();
}
}

void OptimizationManager::ensureStarted() {
Expand Down
2 changes: 2 additions & 0 deletions src/Application/OptimizationManager.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -61,6 +62,7 @@ class OptimizationManager : public QObject, public IOptimizationManager, public
// IWalletAdapterObserver
Q_SLOT virtual void walletOpened() override;
Q_SLOT virtual void walletOpenError(int _initStatus) override;
Q_SLOT virtual void walletRepairStarted() override;
Q_SLOT virtual void walletClosed() override;
Q_SLOT virtual void passwordChanged() override;
Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override;
Expand Down
2 changes: 1 addition & 1 deletion src/CryptoNoteWalletVersion.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define PROJECT_NAME "@CN_CURRENCY_DISPLAY_NAME@ Wallet"
#define PROJECT_COMPANY "Talleo Project"
#define PROJECT_SITE "https://talleo.org/"
#define PROJECT_COPYRIGHT "Copyright 2019-2020, The Talleo Developers"
#define PROJECT_COPYRIGHT "Copyright 2019-@CN_BUILD_YEAR@, The Talleo Developers"
#define APP_VER_MAJOR @CN_VERSION_MAJOR@
#define APP_VER_MINOR @CN_VERSION_MINOR@
#define APP_VER_REV @CN_VERSION_REVISION@
Expand Down
14 changes: 14 additions & 0 deletions src/CryptoNoteWrapper/WalletGreenAdapter.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -89,6 +90,13 @@ IWalletAdapter::PasswordStatus WalletGreenAdapter::changePassword(const QString&
return m_worker->changePassword(_oldPassword, _newPassword);
}


void WalletGreenAdapter::repair() {
Q_ASSERT(m_worker != nullptr);
Q_EMIT walletRepairStarted();
m_worker->repair();
}

void WalletGreenAdapter::close() {
m_worker->removeObserver(this);
deleteWorker();
Expand Down Expand Up @@ -193,6 +201,7 @@ void WalletGreenAdapter::addObserver(IWalletAdapterObserver* _observer) {
QObject* observerObject = dynamic_cast<QObject*>(_observer);
connect(this, SIGNAL(walletOpenedSignal()), observerObject, SLOT(walletOpened()));
connect(this, SIGNAL(walletOpenErrorSignal(int)), observerObject, SLOT(walletOpenError(int)));
connect(this, SIGNAL(walletRepairStartedSignal()), observerObject, SLOT(walletRepairStarted()));
connect(this, SIGNAL(walletClosedSignal()), observerObject, SLOT(walletClosed()));
connect(this, SIGNAL(passwordChangedSignal()), observerObject, SLOT(passwordChanged()));
connect(this, SIGNAL(synchronizationProgressUpdatedSignal(quint32, quint32)), observerObject,
Expand All @@ -209,6 +218,7 @@ void WalletGreenAdapter::removeObserver(IWalletAdapterObserver* _observer) {
QObject* observerObject = dynamic_cast<QObject*>(_observer);
disconnect(this, SIGNAL(walletOpenedSignal()), observerObject, SLOT(walletOpened()));
disconnect(this, SIGNAL(walletOpenErrorSignal(int)), observerObject, SLOT(walletOpenError(int)));
disconnect(this, SIGNAL(walletRepairStartedSignal()), observerObject, SLOT(walletRepairStarted()));
disconnect(this, SIGNAL(walletClosedSignal()), observerObject, SLOT(walletClosed()));
disconnect(this, SIGNAL(passwordChangedSignal()), observerObject, SLOT(passwordChanged()));
disconnect(this, SIGNAL(synchronizationProgressUpdatedSignal(quint32, quint32)), observerObject,
Expand All @@ -229,6 +239,10 @@ void WalletGreenAdapter::walletOpenError(int _initStatus) {
Q_EMIT walletOpenErrorSignal(_initStatus);
}

void WalletGreenAdapter::walletRepairStarted() {
Q_EMIT walletRepairStartedSignal();
}

void WalletGreenAdapter::walletClosed() {
Q_EMIT walletClosedSignal();
}
Expand Down
4 changes: 4 additions & 0 deletions src/CryptoNoteWrapper/WalletGreenAdapter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -48,6 +49,7 @@ class WalletGreenAdapter : public QObject, public IWalletAdapter, public IWallet
virtual WalletSaveStatus save(CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override;
virtual WalletSaveStatus exportWallet(const QString& _path, bool _encrypt, CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override;
virtual PasswordStatus changePassword(const QString& _oldPassword, const QString& _newPassword) override;
virtual void repair() override;
virtual void close() override;

virtual bool isOpen() const override;
Expand Down Expand Up @@ -77,6 +79,7 @@ class WalletGreenAdapter : public QObject, public IWalletAdapter, public IWallet
// IWalletAdapterObserver
Q_SLOT virtual void walletOpened() override;
Q_SLOT virtual void walletOpenError(int _initStatus) override;
Q_SLOT virtual void walletRepairStarted() override;
Q_SLOT virtual void walletClosed() override;
Q_SLOT virtual void passwordChanged() override;
Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override;
Expand All @@ -99,6 +102,7 @@ class WalletGreenAdapter : public QObject, public IWalletAdapter, public IWallet
Q_SIGNALS:
void walletOpenedSignal();
void walletOpenErrorSignal(int _initStatus);
void walletRepairStartedSignal();
void walletClosedSignal();
void passwordChangedSignal();
void synchronizationProgressUpdatedSignal(quint32 _current, quint32 _total);
Expand Down
11 changes: 10 additions & 1 deletion src/CryptoNoteWrapper/WalletGreenWorker.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2021, The Talleo developers
// Copyright (c) 2021-2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -379,6 +379,14 @@ IWalletAdapter::PasswordStatus WalletGreenWorker::changePassword(const QString&
return getPasswordStatus(errorCode);
}

void WalletGreenWorker::repair() {
Q_ASSERT(!m_wallet.isNull());
SemaphoreLocker locker(m_walletSemaphore);
Q_EMIT walletRepairStartedSignal();
m_wallet->repair();
WalletLogger::info(tr("[Wallet] Wallet repair finished"));
}

void WalletGreenWorker::close() {
Q_ASSERT(!m_wallet.isNull());
SemaphoreLocker locker(m_walletSemaphore);
Expand Down Expand Up @@ -703,6 +711,7 @@ void WalletGreenWorker::addObserver(IWalletAdapterObserver* _observer) {
QObject* observerObject = dynamic_cast<QObject*>(_observer);
m_observerConnections[_observer] << connect(this, SIGNAL(walletOpenedSignal()), observerObject, SLOT(walletOpened()), Qt::QueuedConnection);
m_observerConnections[_observer] << connect(this, SIGNAL(walletOpenErrorSignal(int)), observerObject, SLOT(walletOpenError(int)), Qt::QueuedConnection);
m_observerConnections[_observer] << connect(this, SIGNAL(walletRepairStartedSignal()), observerObject, SLOT(walletRepairStarted()), Qt::QueuedConnection);
m_observerConnections[_observer] << connect(this, SIGNAL(walletClosedSignal()), observerObject, SLOT(walletClosed()), Qt::QueuedConnection);
m_observerConnections[_observer] << connect(this, SIGNAL(passwordChangedSignal()), observerObject, SLOT(passwordChanged()), Qt::QueuedConnection);
m_observerConnections[_observer] << connect(this, SIGNAL(synchronizationProgressUpdatedSignal(quint32, quint32)), observerObject,
Expand Down
3 changes: 3 additions & 0 deletions src/CryptoNoteWrapper/WalletGreenWorker.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -60,6 +61,7 @@ class WalletGreenWorker : public QObject, public IWalletAdapter {
virtual WalletSaveStatus save(CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override;
virtual WalletSaveStatus exportWallet(const QString& _path, bool _encrypt, CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override;
virtual PasswordStatus changePassword(const QString& _oldPassword, const QString& _newPassword) override;
virtual void repair() override;
virtual void close() override;

virtual bool isOpen() const override;
Expand Down Expand Up @@ -113,6 +115,7 @@ class WalletGreenWorker : public QObject, public IWalletAdapter {
Q_SIGNALS:
void walletOpenedSignal();
void walletOpenErrorSignal(int _initStatus);
void walletRepairStartedSignal();
void walletClosedSignal();
void passwordChangedSignal();
void synchronizationProgressUpdatedSignal(quint32 _current, quint32 _total);
Expand Down
29 changes: 25 additions & 4 deletions src/Gui/MainWindow/MainWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2015-2018, The Bytecoin developers
// Copyright (c) 2018, The PinkstarcoinV2 developers
// Copyright (c) 2018, The Bittorium developers
// Copyright (c) 2019-2020, The Talleo developers
// Copyright (c) 2019-2023, The Talleo developers
//
// This file is part of Bytecoin.
//
Expand Down Expand Up @@ -253,6 +253,10 @@ void MainWindow::walletOpenError(int _initStatus) {
}
}

void MainWindow::walletRepairStarted() {
// Do nothing
}

void MainWindow::walletClosed() {
setClosedState();
}
Expand Down Expand Up @@ -364,6 +368,7 @@ void MainWindow::closeEvent(QCloseEvent* _event) {
}

void MainWindow::setOpenedState() {
setWindowTitle(tr("Talleo Wallet %1 - %2").arg(Settings::instance().getVersion()).arg(QDir::toNativeSeparators(Settings::instance().getWalletFile())));

QList<QAbstractButton*> toolButtons = m_ui->m_toolButtonGroup->buttons();
for (const auto& button : toolButtons) {
Expand All @@ -374,6 +379,7 @@ void MainWindow::setOpenedState() {
IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter();
m_ui->m_backupWalletAction->setEnabled(true);
m_ui->m_resetAction->setEnabled(true);
m_ui->m_repairAction->setEnabled(true);
m_ui->m_exportTrackingKeyAction->setEnabled(true);
m_ui->m_encryptWalletAction->setEnabled(!walletAdapter->isEncrypted());
m_ui->m_changePasswordAction->setEnabled(walletAdapter->isEncrypted());
Expand All @@ -386,6 +392,8 @@ void MainWindow::setOpenedState() {
}

void MainWindow::setClosedState() {
setWindowTitle(tr("Talleo Wallet %1").arg(Settings::instance().getVersion()));

QList<QAbstractButton*> toolButtons = m_ui->m_toolButtonGroup->buttons();
for (const auto& button : toolButtons) {
button->setChecked(false);
Expand All @@ -394,6 +402,7 @@ void MainWindow::setClosedState() {

m_ui->m_backupWalletAction->setEnabled(false);
m_ui->m_resetAction->setEnabled(false);
m_ui->m_repairAction->setEnabled(false);
m_ui->m_exportTrackingKeyAction->setEnabled(false);
m_ui->m_encryptWalletAction->setEnabled(false);
m_ui->m_changePasswordAction->setEnabled(false);
Expand Down Expand Up @@ -462,7 +471,7 @@ void MainWindow::updateRecentWalletActions() {
QStringList recentWallets = Settings::instance().getRecentWalletList();
int recentWalletCount = qMin(recentWallets.size(), MAX_RECENT_WALLET_COUNT);
for (int i = 0; i < recentWalletCount; ++i) {
m_recentWalletsActionList[i]->setText(recentWallets[i]);
m_recentWalletsActionList[i]->setText(QDir::toNativeSeparators(recentWallets[i]));
m_recentWalletsActionList[i]->setData(recentWallets[i]);
m_recentWalletsActionList[i]->setVisible(true);
}
Expand Down Expand Up @@ -634,6 +643,18 @@ void MainWindow::saveWalletKeys() {
}
}

void MainWindow::repairWallet() {
qApp->processEvents(); // Make sure GUI redraws once before repair starts
IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter();
Q_ASSERT(walletAdapter->isOpen());
walletAdapter->repair();
walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true);
walletAdapter->removeObserver(this);
walletAdapter->close();
walletAdapter->addObserver(this);
m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString());
}

void MainWindow::resetWallet() {
QuestionDialog dlg(tr("Reset wallet?"), tr("Reset wallet to re-synchronise its transactions and balance based\n"
"on the blockchain data. This operation can take some time.\n"
Expand All @@ -645,8 +666,8 @@ void MainWindow::resetWallet() {
IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter();
Q_ASSERT(walletAdapter->isOpen());
QString fileName = Settings::instance().getWalletFile();
QDateTime currenctDateTime = QDateTime::currentDateTime();
fileName.append(QString(".%1.backup").arg(currenctDateTime.toString("yyyyMMddHHMMss")));
QDateTime _currentDateTime = QDateTime::currentDateTime();
fileName.append(QString(".%1.backup").arg(_currentDateTime.toString("yyyyMMddHHMMss")));

walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_KEYS_ONLY, true);
walletAdapter->removeObserver(this);
Expand Down
Loading

0 comments on commit 15d6bcb

Please sign in to comment.