less DEBUG flood, add an automation that triggers when there are less than 7 free spendable notes and increases their number by executing a transaction with the amount = fee by replacing a sietch transaction.
This commit is contained in:
@@ -304,7 +304,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
});
|
});
|
||||||
|
|
||||||
auto fnSetTargetLabelAddr = [=] (QLineEdit* target, QString label, QString addr, QString myAddr, QString cid, QString avatar) {
|
auto fnSetTargetLabelAddr = [=] (QLineEdit* target, QString label, QString addr, QString myAddr, QString cid, QString avatar) {
|
||||||
qDebug() << __func__ << ": label=" << label << " cid=" << cid << " avatar=" << avatar;
|
// qDebug() << __func__ << ": label=" << label << " cid=" << cid << " avatar=" << avatar;
|
||||||
target->setText(label % "/" % addr % myAddr);
|
target->setText(label % "/" % addr % myAddr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -794,7 +794,7 @@ Tx MainWindow::createTxForSafeContactRequest()
|
|||||||
|
|
||||||
if (crypto_kx_seed_keypair(pk, sk, MESSAGEAS1) !=0) {
|
if (crypto_kx_seed_keypair(pk, sk, MESSAGEAS1) !=0) {
|
||||||
this->logger->write("Suspicious client public contact request key, bail out ");
|
this->logger->write("Suspicious client public contact request key, bail out ");
|
||||||
qDebug() << __func__ << ": Suspicious client public send key from crypto_kx_seed_keypair, aborting!";
|
// qDebug() << __func__ << ": Suspicious client public send key from crypto_kx_seed_keypair, aborting!";
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc)
|
|||||||
connD->setupUi(d);
|
connD->setupUi(d);
|
||||||
|
|
||||||
auto theme = Settings::getInstance()->get_theme_name();
|
auto theme = Settings::getInstance()->get_theme_name();
|
||||||
DEBUG("theme " << theme << " has loaded");
|
//DEBUG("theme " << theme << " has loaded");
|
||||||
auto size = QSize(512,512);
|
auto size = QSize(512,512);
|
||||||
|
|
||||||
if (theme == "Dark" || theme == "Midnight") {
|
if (theme == "Dark" || theme == "Midnight") {
|
||||||
@@ -57,7 +57,7 @@ ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc)
|
|||||||
|
|
||||||
ConnectionLoader::~ConnectionLoader()
|
ConnectionLoader::~ConnectionLoader()
|
||||||
{
|
{
|
||||||
DEBUG("destroying ConnectionLoader");
|
// DEBUG("destroying ConnectionLoader");
|
||||||
delete isSyncing;
|
delete isSyncing;
|
||||||
delete connD;
|
delete connD;
|
||||||
delete d;
|
delete d;
|
||||||
@@ -389,7 +389,7 @@ QString litelib_process_response(char* resp)
|
|||||||
void Executor::run()
|
void Executor::run()
|
||||||
{
|
{
|
||||||
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
||||||
DEBUG("cmd=" << cmd << " args=" << args << " server=" << config->server);
|
//DEBUG("cmd=" << cmd << " args=" << args << " server=" << config->server);
|
||||||
QString response = "";
|
QString response = "";
|
||||||
try {
|
try {
|
||||||
char* resp = litelib_execute(this->cmd.toStdString().c_str(), this->args.toStdString().c_str());
|
char* resp = litelib_execute(this->cmd.toStdString().c_str(), this->args.toStdString().c_str());
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ void Controller::setConnection(Connection* c)
|
|||||||
ui->listChat->verticalScrollBar()->setValue(
|
ui->listChat->verticalScrollBar()->setValue(
|
||||||
ui->listChat->verticalScrollBar()->maximum());
|
ui->listChat->verticalScrollBar()->maximum());
|
||||||
|
|
||||||
fetchAndProcessUnspentNotes();
|
//fetch amounts of notes at startup
|
||||||
|
fetchAndProcessUnspentNotes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,13 +161,14 @@ void Controller::fillTxJsonParams(json& allRecepients, Tx tx)
|
|||||||
|
|
||||||
DataStore::getSietchDataStore()->clear(); // clears the datastore
|
DataStore::getSietchDataStore()->clear(); // clears the datastore
|
||||||
|
|
||||||
// Debugging, um die Daten aus NoteCountDataStore zu zeigen
|
// Only for Debugging/Testing: How many free Notes are available?
|
||||||
int spendableNotesCount = NoteCountDataStore::getInstance()->getSpendableNotesCount();
|
int spendableNotesCount = NoteCountDataStore::getInstance()->getSpendableNotesCount();
|
||||||
QString addressWithMaxValue = NoteCountDataStore::getInstance()->getAddressWithMaxValue();
|
QString addressWithMaxValue = NoteCountDataStore::getInstance()->getAddressWithMaxValue();
|
||||||
|
|
||||||
qDebug() << "Anzahl der spendablen Notizen über 10000:" << spendableNotesCount;
|
qDebug() << "Available notes over fee:" << spendableNotesCount;
|
||||||
qDebug() << "Adresse mit dem höchsten Gesamtwert:" << addressWithMaxValue;
|
|
||||||
|
|
||||||
|
// Clear NoteCountDataStore
|
||||||
|
DataStore::getNoteCountDataStore()->clear();
|
||||||
|
|
||||||
const QString possibleCharacters("0123456789abcdef");
|
const QString possibleCharacters("0123456789abcdef");
|
||||||
int sizerandomString = 512;
|
int sizerandomString = 512;
|
||||||
@@ -186,11 +188,41 @@ qDebug() << "Adresse mit dem höchsten Gesamtwert:" << addressWithMaxValue;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto &it: dust)
|
// Create more Notes if spendableNotesCount < 7
|
||||||
{
|
bool extraTransactionAdded = false;
|
||||||
|
|
||||||
|
if (spendableNotesCount < 7) {
|
||||||
|
// Create a random memo for that
|
||||||
|
QString randomMemo;
|
||||||
|
for (int i = 0; i < randomStringLength; ++i) {
|
||||||
|
int index = QRandomGenerator::system()->bounded(0, possibleCharacters.length());
|
||||||
|
randomMemo.append(possibleCharacters.at(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the transaction
|
||||||
|
json extraTransaction = json::object();
|
||||||
|
extraTransaction["address"] = addressWithMaxValue.toStdString();
|
||||||
|
extraTransaction["amount"] = 12000;
|
||||||
|
extraTransaction["memo"] = randomMemo.toStdString();
|
||||||
|
|
||||||
|
// Replace one sietch transaction
|
||||||
|
if (!dust.empty()) {
|
||||||
|
dust.front() = extraTransaction;
|
||||||
|
extraTransactionAdded = true;
|
||||||
|
} else {
|
||||||
|
dust.push_back(extraTransaction);
|
||||||
|
extraTransactionAdded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set amount = 0 to all sietch transactions
|
||||||
|
for(auto &it: dust) {
|
||||||
|
if (!extraTransactionAdded || it["address"] != addressWithMaxValue.toStdString()) {
|
||||||
it["amount"] = 0;
|
it["amount"] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
||||||
for (int i=0; i < tx.toAddrs.size(); i++)
|
for (int i=0; i < tx.toAddrs.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -249,7 +281,6 @@ qDebug() << "Adresse mit dem höchsten Gesamtwert:" << addressWithMaxValue;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::noConnection()
|
void Controller::noConnection()
|
||||||
@@ -1547,6 +1578,9 @@ void Controller::executeTransaction(Tx tx,
|
|||||||
const std::function<void(QString txid)> submitted,
|
const std::function<void(QString txid)> submitted,
|
||||||
const std::function<void(QString txid, QString errStr)> error)
|
const std::function<void(QString txid, QString errStr)> error)
|
||||||
{
|
{
|
||||||
|
// Refresh the available unspent notes
|
||||||
|
fetchAndProcessUnspentNotes();
|
||||||
|
|
||||||
unlockIfEncrypted([=] () {
|
unlockIfEncrypted([=] () {
|
||||||
// First, create the json params
|
// First, create the json params
|
||||||
json params = json::array();
|
json params = json::array();
|
||||||
@@ -1572,7 +1606,6 @@ void Controller::executeTransaction(Tx tx,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Controller::checkForUpdate(bool silent)
|
void Controller::checkForUpdate(bool silent)
|
||||||
{
|
{
|
||||||
// qDebug()<< __func__;
|
// qDebug()<< __func__;
|
||||||
@@ -1666,7 +1699,7 @@ void Controller::checkForUpdate(bool silent)
|
|||||||
// Get the hush->USD price from coinmarketcap using their API
|
// Get the hush->USD price from coinmarketcap using their API
|
||||||
void Controller::refreshHUSHPrice()
|
void Controller::refreshHUSHPrice()
|
||||||
{
|
{
|
||||||
qDebug()<< __func__;
|
// qDebug()<< __func__;
|
||||||
if (!zrpc->haveConnection())
|
if (!zrpc->haveConnection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ void MainWindow::closeEvent(QCloseEvent* event) {
|
|||||||
|
|
||||||
void MainWindow::closeEventpw(QCloseEvent* event) {
|
void MainWindow::closeEventpw(QCloseEvent* event) {
|
||||||
// Let the RPC know to shut down any running service.
|
// Let the RPC know to shut down any running service.
|
||||||
qDebug() << __func__ << ": event=" << event << " this=" << this;
|
// qDebug() << __func__ << ": event=" << event << " this=" << this;
|
||||||
if (rpc) {
|
if (rpc) {
|
||||||
rpc->shutdownhushd();
|
rpc->shutdownhushd();
|
||||||
} else {
|
} else {
|
||||||
@@ -742,7 +742,7 @@ void MainWindow::setMoneyMemo(QString moneymemo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupStatusBar() {
|
void MainWindow::setupStatusBar() {
|
||||||
qDebug() << __func__ << endl;
|
// qDebug() << __func__ << endl;
|
||||||
// Status Bar
|
// Status Bar
|
||||||
loadingLabel = new QLabel();
|
loadingLabel = new QLabel();
|
||||||
loadingMovie = new QMovie(":/icons/res/loading.gif");
|
loadingMovie = new QMovie(":/icons/res/loading.gif");
|
||||||
|
|||||||
Reference in New Issue
Block a user