check for funds before spread notes

This commit is contained in:
Deniod
2024-01-12 14:05:46 +01:00
parent c802a55bac
commit c6e8268450

View File

@@ -187,9 +187,10 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
dust.at(i)["memo"] = randomString.toStdString();
}
// Create more Notes if spendableNotesCount < 30
if (spendableNotesCount < 30) {
CAmount balanceAvailable = getModel()->getBalVerified();
// Create more Notes if spendableNotesCount < 30 and enough funds are available
if (spendableNotesCount < 30 || balanceAvailable.toDecimalhushString().toDouble() > (dust.size() * 0.0001)) {
// Create extra transaction
for (size_t i = 0; i < dust.size(); ++i) {
// Generate random memo
@@ -218,7 +219,7 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
rec["amount"] = toAddr.amount.toqint64();
if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.trimmed().isEmpty())
rec["memo"] = toAddr.memo.toStdString();
}
}
allRecepients.push_back(rec);
@@ -1523,7 +1524,6 @@ void Controller::executeStandardUITransaction(Tx tx)
);
}
// Execute a transaction!
void Controller::executeTransaction(Tx tx,
const std::function<void(QString txid)> submitted,