diff --git a/src/controller.cpp b/src/controller.cpp index 0161b55..92328f6 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -265,8 +265,6 @@ void Controller::processUnspent(const json& reply, QMap* balanc bool spendable = it["unconfirmed_spent"].is_null() && it["spent"].is_null(); // TODO: Wait for 4 confirmations bool pending = !it["unconfirmed_spent"].is_null(); - qDebug() << "For address" << qsAddr << "spendable, pending" << spendable << ":" << pending; - unspentOutputs->push_back(UnspentOutput{ qsAddr, txid, amount, block, spendable, pending }); if (spendable) { (*balancesMap)[qsAddr] = (*balancesMap)[qsAddr] + it["value"].get(); @@ -344,7 +342,7 @@ void Controller::refreshTransactions() { for (auto o: it["outgoing_metadata"].get()) { QString address = QString::fromStdString(o["address"]); - qint64 amount = -1 * o["value"].get(); // Sent items are -ve + qint64 amount = -1 * o["value"].get(); // Sent items are -ve QString memo; if (!o["memo"].is_null()) { @@ -385,7 +383,7 @@ void Controller::refreshTransactions() { it["datetime"].get(), address, QString::fromStdString(it["txid"]), - model->getLatestBlock() - it["block_height"].get(), + model->getLatestBlock() - it["block_height"].get() + 1, items }; @@ -432,10 +430,10 @@ void Controller::executeTransaction(Tx tx, zrpc->sendTransaction(QString::fromStdString(params.dump()), [=](const json& reply) { if (reply.find("txid") == reply.end()) { error("", "Couldn't understand Response: " + QString::fromStdString(reply.dump())); + } else { + QString txid = QString::fromStdString(reply["txid"].get()); + submitted(txid); } - - QString txid = QString::fromStdString(reply["txid"].get()); - submitted(txid); }, [=](QString errStr) { error("", errStr); diff --git a/src/settings.cpp b/src/settings.cpp index edc7b93..d9b1183 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -189,6 +189,10 @@ QString Settings::getUSDFromZecAmount(qint64 bal) { } QString Settings::getDecimalString(qint64 amt) { + if (amt < 0) { + return "-" + Settings::getDecimalString(-1 * amt); + } + // Zcash has 8 decimal places int places = Settings::getNumberOfDecimalPlaces(); qint64 divider = QString("1" + QString("0").repeated(places)).toULongLong();