From 26a9788f7fb105dab55be0e36736cd664fc69bac Mon Sep 17 00:00:00 2001 From: fekt Date: Thu, 6 Oct 2022 12:28:34 -0400 Subject: [PATCH] Fixes for timer to not constantly poll z_getoperationstatus --- src/rpc.cpp | 7 ++++--- src/sendtab.cpp | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/rpc.cpp b/src/rpc.cpp index a36ba7c..a0125e3 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -52,14 +52,13 @@ RPC::RPC(MainWindow* main) { }); timer->start(Settings::updateSpeed); + // Set up the timer to watch for tx status txTimer = new QTimer(main); QObject::connect(txTimer, &QTimer::timeout, [=]() { //qDebug() << "Watching tx status"; watchTxStatus(); }); - - txTimer->start(Settings::updateSpeed); qDebug() << __func__ << "Done settings up all timers"; usedAddresses = new QMap(); @@ -1180,8 +1179,10 @@ void RPC::watchTxStatus() { } if (watchingOps.isEmpty()) { - txTimer->start(Settings::updateSpeed); + // Stop the timer + txTimer->stop(); } else { + // Keep polling for updates txTimer->start(Settings::quickUpdateSpeed); } } diff --git a/src/sendtab.cpp b/src/sendtab.cpp index d185735..a56b72b 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -722,7 +722,7 @@ void MainWindow::sendButton() { qDebug() << "Computing opid: " << opid; }, - [=] (QString, QString txid) { + [=] (QString, QString txid) { ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid); connD->status->setText(tr("Done!")); @@ -737,7 +737,8 @@ void MainWindow::sendButton() { // And switch to the balances tab ui->tabWidget->setCurrentIndex(0); }); - // Force a UI update so we get the unconfirmed Tx + + // Force a UI update so we get the unconfirmed Tx rpc->refresh(true); }, [=] (QString opid, QString errStr) {