From e25a69f6c9abb43e4efc3fb58fa29b6cc2703682 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 15 Dec 2019 07:52:04 -0500 Subject: [PATCH] Delete various sprout stuff --- src/mainwindow.cpp | 19 ++++++++----------- src/mainwindow.h | 2 +- src/rpc.cpp | 4 ++-- src/rpc.h | 2 +- src/sendtab.cpp | 8 ++++---- src/websockets.cpp | 3 --- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 20534f0..30b10e9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -993,8 +993,7 @@ void MainWindow::setupTransactionsTab() { int lastPost = memo.trimmed().lastIndexOf(QRegExp("[\r\n]+")); QString lastWord = memo.right(memo.length() - lastPost - 1); - if (Settings::getInstance()->isSaplingAddress(lastWord) || - Settings::getInstance()->isSproutAddress(lastWord)) { + if (Settings::getInstance()->isSaplingAddress(lastWord)) { menu.addAction(tr("Reply to ") + lastWord.left(25) + "...", [=]() { // First, cancel any pending stuff in the send tab by pretending to click // the cancel button @@ -1020,26 +1019,24 @@ void MainWindow::setupTransactionsTab() { }); } -void MainWindow::addNewZaddr(bool sapling) { - rpc->newZaddr(sapling, [=] (json reply) { +void MainWindow::addNewZaddr() { + rpc->newZaddr( [=] (json reply) { QString addr = QString::fromStdString(reply.get()); // Make sure the RPC class reloads the z-addrs for future use rpc->refreshAddresses(); // Just double make sure the z-address is still checked - if ( sapling && ui->rdioZSAddr->isChecked() ) { + if ( ui->rdioZSAddr->isChecked() ) { ui->listReceiveAddresses->insertItem(0, addr); ui->listReceiveAddresses->setCurrentIndex(0); - ui->statusBar->showMessage(QString::fromStdString("Created new zAddr") % - (sapling ? "(Sapling)" : "(Sprout)"), - 10 * 1000); + ui->statusBar->showMessage(QString::fromStdString("Created new Sapling zaddr"), 10 * 1000); } }); } -// Adds sapling or sprout z-addresses to the combo box. Technically, returns a +// Adds z-addresses to the combo box. Technically, returns a // lambda, which can be connected to the appropriate signal std::function MainWindow::addZAddrsToComboList(bool sapling) { return [=] (bool checked) { @@ -1059,7 +1056,7 @@ std::function MainWindow::addZAddrsToComboList(bool sapling) { // If z-addrs are empty, then create a new one. if (addrs->isEmpty()) { - addNewZaddr(sapling); + addNewZaddr(); } } }; @@ -1144,7 +1141,7 @@ void MainWindow::setupReceiveTab() { return; if (ui->rdioZSAddr->isChecked()) { - addNewZaddr(true); + addNewZaddr(); } else if (ui->rdioTAddr->isChecked()) { addNewTAddr(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index ea37011..ffcaa77 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -106,7 +106,7 @@ private: void addressChanged(int number, const QString& text); void amountChanged (int number, const QString& text); - void addNewZaddr(bool sapling); + void addNewZaddr(); std::function addZAddrsToComboList(bool sapling); void memoButtonClicked(int number, bool includeReplyTo = false); diff --git a/src/rpc.cpp b/src/rpc.cpp index 616aca8..db3d212 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -153,12 +153,12 @@ void RPC::getZUnspent(const std::function& cb) { conn->doRPCWithDefaultErrorHandling(payload, cb); } -void RPC::newZaddr(bool sapling, const std::function& cb) { +void RPC::newZaddr(const std::function& cb) { json payload = { {"jsonrpc", "1.0"}, {"id", "someid"}, {"method", "z_getnewaddress"}, - {"params", { sapling ? "sapling" : "sprout" }}, + {"params", { "sapling" }}, }; conn->doRPCWithDefaultErrorHandling(payload, cb); diff --git a/src/rpc.h b/src/rpc.h index 7521345..40a3b5d 100644 --- a/src/rpc.h +++ b/src/rpc.h @@ -68,7 +68,7 @@ public: const QMap* getAllBalances() { return allBalances; } const QMap* getUsedAddresses() { return usedAddresses; } - void newZaddr(bool sapling, const std::function& cb); + void newZaddr(const std::function& cb); void newTaddr(const std::function& cb); void getZPrivKey(QString addr, const std::function& cb); diff --git a/src/sendtab.cpp b/src/sendtab.cpp index 70ac8ca..5c95178 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -497,9 +497,6 @@ Tx MainWindow::createTxFromSendPage() { // Remove label if it exists addr = AddressBook::addressFromAddressLabel(addr); - // If address is sprout, then we can't send change to sapling, because of turnstile. - //sendChangeToSapling = sendChangeToSapling && !Settings::getInstance()->isSproutAddress(addr); - double amt = ui->sendToWidgets->findChild(QString("Amount") % QString::number(i+1))->text().trimmed().toDouble(); totalAmt += amt; QString memo = ui->sendToWidgets->findChild(QString("MemoTxt") % QString::number(i+1))->text().trimmed(); @@ -732,7 +729,10 @@ void MainWindow::sendButton() { QString MainWindow::doSendTxValidations(Tx tx) { //TODO: Feedback fromAddr is empty for some reason - if (!Settings::isValidAddress(tx.fromAddr)) return QString(tr("From Address is Invalid")); + if (!Settings::isValidAddress(tx.fromAddr)){ + qDebug() << "address is invalid! " << tx.fromAddr; + return QString(tr("From Address is Invalid!")); + } for (auto toAddr : tx.toAddrs) { if (!Settings::isValidAddress(toAddr.addr)) { diff --git a/src/websockets.cpp b/src/websockets.cpp index 9bba90f..dfd9bf9 100644 --- a/src/websockets.cpp +++ b/src/websockets.cpp @@ -747,9 +747,6 @@ void AppDataServer::processSendTx(QJsonObject sendTx, MainWindow* mainwindow, st auto allBalances = mainwindow->getRPC()->getAllBalances(); QList> bals; for (auto i : allBalances->keys()) { - // Filter out sprout addresses - if (Settings::getInstance()->isSproutAddress(i)) - continue; // Filter out balances that don't have the requisite amount // TODO: should this be amt+tx.fee? if (allBalances->value(i) < amt)