Handle 0 change case

This commit is contained in:
adityapk00
2018-11-24 08:17:46 -08:00
parent a2db1dc8a6
commit 7d6bf31caa
2 changed files with 7 additions and 2 deletions

View File

@@ -413,8 +413,10 @@ Tx MainWindow::createTxFromSendPage() {
if (saplingAddr != rpc->getAllZAddresses()->end()) {
double change = rpc->getAllBalances()->value(tx.fromAddr) - totalAmt - tx.fee;
QString changeMemo = "Change from " + tx.fromAddr;
tx.toAddrs.push_back( ToFields{*saplingAddr, change, changeMemo, changeMemo.toUtf8().toHex()} );
if (Settings::getDecimalString(change) != "0") {
QString changeMemo = "Change from " + tx.fromAddr;
tx.toAddrs.push_back(ToFields{ *saplingAddr, change, changeMemo, changeMemo.toUtf8().toHex() });
}
}
}