From b2d764c2e83fc016d70602c704383c0c1d92dbe1 Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Mon, 19 Nov 2018 16:30:19 -0800 Subject: [PATCH] Work with testnet for wallet.dat backups --- src/mainwindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ea4584e..5742e00 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -642,16 +642,22 @@ void MainWindow::importPrivKey() { } void MainWindow::backupWalletDat() { - QFile wallet(QDir(rpc->getConnection()->config->zcashDir).filePath("wallet.dat")); + QDir zcashdir(rpc->getConnection()->config->zcashDir); + QString backupDefaultName = "zcash-wallet-backup-" + QDateTime::currentDateTime().toString("yyyyMMdd") + ".dat"; + + if (Settings::getInstance()->isTestnet()) { + zcashdir.cd("testnet3"); + backupDefaultName = "tesetnet-" + backupDefaultName; + } + + QFile wallet(zcashdir.filePath("wallet.dat")); if (!wallet.exists()) { QMessageBox::critical(this, "No wallet.dat", "Couldn't find the wallet.dat on this computer." "You need to back it up from the machine zcashd is running on", QMessageBox::Ok); return; } - QUrl backupName = QFileDialog::getSaveFileUrl(this, "Backup wallet.dat", - "zcash-wallet-backup-" + QDateTime::currentDateTime().toString("yyyyMMdd") + ".dat", - "Data file (*.dat)"); + QUrl backupName = QFileDialog::getSaveFileUrl(this, "Backup wallet.dat", backupDefaultName, "Data file (*.dat)"); if (backupName.isEmpty()) return;