diff --git a/lib/Cargo.lock b/lib/Cargo.lock index e32ab35..540dfaf 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1051,7 +1051,7 @@ version = "0.1.0" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254)", + "zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=165c22e39e5b43d417f8719edcf91b07c15906bf)", ] [[package]] @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "zecwalletlitelib" version = "0.1.0" -source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254#96997c5a467b710286bc9c6fea818b9d7d76f254" +source = "git+https://github.com/adityapk00/zecwallet-light-cli?rev=165c22e39e5b43d417f8719edcf91b07c15906bf#165c22e39e5b43d417f8719edcf91b07c15906bf" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bellman 0.1.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)", @@ -2562,4 +2562,4 @@ dependencies = [ "checksum zcash_client_backend 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_primitives 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" "checksum zcash_proofs 0.0.0 (git+https://github.com/adityapk00/librustzcash.git?rev=188537ea025fcb7fbdfc11266f307a084a5451e4)" = "" -"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=96997c5a467b710286bc9c6fea818b9d7d76f254)" = "" +"checksum zecwalletlitelib 0.1.0 (git+https://github.com/adityapk00/zecwallet-light-cli?rev=165c22e39e5b43d417f8719edcf91b07c15906bf)" = "" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index ccab1bf..3237cce 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -11,4 +11,4 @@ crate-type = ["staticlib"] [dependencies] libc = "0.2.58" lazy_static = "1.4.0" -zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "96997c5a467b710286bc9c6fea818b9d7d76f254" } +zecwalletlitelib = { git = "https://github.com/adityapk00/zecwallet-light-cli", rev = "165c22e39e5b43d417f8719edcf91b07c15906bf" } diff --git a/src/connection.cpp b/src/connection.cpp index f74584f..cb7cb4e 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -139,7 +139,6 @@ Connection* ConnectionLoader::makeConnection(std::shared_ptr c // Update the UI with the status void ConnectionLoader::showInformation(QString info, QString detail) { - qDebug() << "Showing info " << info << ":" << detail; connD->status->setText(info); connD->statusDetail->setText(detail); } diff --git a/src/controller.h b/src/controller.h index 981730d..43a8e0b 100644 --- a/src/controller.h +++ b/src/controller.h @@ -62,6 +62,8 @@ public: void saveWallet(const std::function& cb) { zrpc->saveWallet(cb); } + void clearWallet(const std::function& cb) { zrpc->clearWallet(cb); } + void createNewZaddr(bool sapling, const std::function& cb) { unlockIfEncrypted([=] () { zrpc->createNewZaddr(sapling, cb); diff --git a/src/liteinterface.cpp b/src/liteinterface.cpp index 0f4bfe9..c9e5138 100644 --- a/src/liteinterface.cpp +++ b/src/liteinterface.cpp @@ -84,6 +84,13 @@ void LiteInterface::saveWallet(const std::function& cb) { conn->doRPCWithDefaultErrorHandling("save", "", cb); } +void LiteInterface::clearWallet(const std::function& cb) { + if (conn == nullptr) + return; + + conn->doRPCWithDefaultErrorHandling("clear", "", cb); +} + void LiteInterface::unlockWallet(QString password, const std::function& cb) { if (conn == nullptr) return; diff --git a/src/liteinterface.h b/src/liteinterface.h index 70b5732..a1aea04 100644 --- a/src/liteinterface.h +++ b/src/liteinterface.h @@ -58,6 +58,7 @@ public: void fetchSeed(const std::function&); void saveWallet(const std::function& cb); + void clearWallet(const std::function& cb); void fetchWalletEncryptionStatus(const std::function& cb); void encryptWallet(QString password, const std::function& cb); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d03ef72..c9ccc94 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -105,6 +105,20 @@ MainWindow::MainWindow(QWidget *parent) : AppDataServer::getInstance()->connectAppDialog(this); }); + // Rescan + QObject::connect(ui->actionRescan, &QAction::triggered, [=]() { + // To rescan, we clear the wallet state, and then reload the connection + // This will start a sync, and show the scanning status. + getRPC()->clearWallet([=] (auto) { + // Save the wallet + getRPC()->saveWallet([=] (auto) { + // Then reload the connection. The ConnectionLoader deletes itself. + auto cl = new ConnectionLoader(this, rpc); + cl->loadConnection(); + }); + }); + }); + // Address Book QObject::connect(ui->action_Address_Book, &QAction::triggered, this, &MainWindow::addressBook); @@ -419,12 +433,6 @@ void MainWindow::setupSettingsModal() { // Connection tab by default settings.tabWidget->setCurrentIndex(0); - // Enable the troubleshooting options only if using embedded zcashd - if (!rpc->isEmbedded()) { - settings.chkRescan->setEnabled(false); - settings.chkRescan->setToolTip(tr("You're using an external zcashd. Please restart zcashd with -rescan")); - } - if (settingsDialog.exec() == QDialog::Accepted) { // Check for updates Settings::getInstance()->setCheckForUpdates(settings.chkCheckUpdates->isChecked()); @@ -445,7 +453,7 @@ void MainWindow::setupSettingsModal() { // Save the wallet getRPC()->saveWallet([=] (auto) { - // Then reload the connection + // Then reload the connection. The ConnectionLoader deletes itself. auto cl = new ConnectionLoader(this, rpc); cl->loadConnection(); }); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index cb8260e..7403eff 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -392,8 +392,8 @@ 0 0 - 1226 - 504 + 1162 + 344 @@ -1088,7 +1088,7 @@ 0 0 1274 - 22 + 39 @@ -1130,6 +1130,8 @@ + + @@ -1226,6 +1228,11 @@ Remove Wallet Encryption + + + Rescan + + diff --git a/src/settings.ui b/src/settings.ui index ae44092..a0fa476 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -6,7 +6,7 @@ 0 0 - 540 + 733 539 @@ -20,7 +20,7 @@ - 0 + 1 @@ -183,50 +183,6 @@ - - - Troubleshooting - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - - - Rescan the blockchain for any missing wallet transactions and to correct your wallet balance. This may take several hours. You need to restart ZecWallet for this to take effect - - - true - - - - - - - Rescan - - - - -