mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-28 19:58:35 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3509a6c3b | ||
|
|
93d13a6568 | ||
|
|
64326119eb |
+1
-1
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
project(feather
|
||||
VERSION "5.0.2"
|
||||
VERSION "5.0.3"
|
||||
DESCRIPTION "A free Monero desktop wallet"
|
||||
LANGUAGES CXX C ASM
|
||||
)
|
||||
|
||||
@@ -542,6 +542,24 @@ void MainWindow::initWalletContext() {
|
||||
connect(m_wallet, &Wallet::deviceError, this, &MainWindow::onDeviceError);
|
||||
|
||||
connect(m_wallet, &Wallet::multiBroadcast, this, &MainWindow::onMultiBroadcast);
|
||||
|
||||
// wowlet: count multi-broadcast relay results so a total failure (Tor not
|
||||
// bootstrapped, every node unreachable) is surfaced instead of silent.
|
||||
connect(m_rpc, &DaemonRpc::ApiResponse, this, [this](const DaemonRpc::DaemonResponse &resp){
|
||||
if (resp.endpoint == DaemonRpc::Endpoint::SEND_RAW_TRANSACTION && resp.ok) {
|
||||
m_broadcastBatchSuccesses++;
|
||||
}
|
||||
});
|
||||
|
||||
// wowlet: when the embedded daemon reports synced after a (re)start,
|
||||
// re-announce any still-pending outgoing txs; a restarted pool has
|
||||
// forgotten them.
|
||||
connect(daemonManager(), &DaemonManager::synced, this, &MainWindow::relayPendingTransactions);
|
||||
|
||||
// wowlet: periodic local check for outgoing txs stuck unconfirmed.
|
||||
m_stuckTxTimer = new QTimer(this);
|
||||
connect(m_stuckTxTimer, &QTimer::timeout, this, &MainWindow::checkStuckTransactions);
|
||||
m_stuckTxTimer->start(2 * 60 * 1000);
|
||||
}
|
||||
|
||||
void MainWindow::menuToggleTabVisible(const QString &key){
|
||||
@@ -760,6 +778,7 @@ void MainWindow::onSubtractFeeFromAmountEnabled(bool enabled) {
|
||||
}
|
||||
|
||||
void MainWindow::onMultiBroadcast(const QMap<QString, QString> &txHexMap) {
|
||||
m_broadcastBatchSuccesses = 0;
|
||||
QMapIterator<QString, QString> i(txHexMap);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
@@ -770,6 +789,99 @@ void MainWindow::onMultiBroadcast(const QMap<QString, QString> &txHexMap) {
|
||||
m_rpc->sendRawTransaction(i.value());
|
||||
}
|
||||
}
|
||||
|
||||
// wowlet: if not a single node accepted the relay, say so. The commit to
|
||||
// the local daemon may still confirm on its own, but when Tor is down and
|
||||
// the daemon runs with an exclusive --tx-proxy, nothing will ever leave
|
||||
// this machine; the user should know within a minute, not after two days.
|
||||
const QStringList txids = txHexMap.keys();
|
||||
QTimer::singleShot(45 * 1000, this, [this, txids]{
|
||||
if (m_broadcastBatchSuccesses > 0 || txids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QMessageBox box(this);
|
||||
box.setWindowTitle("Transaction relay may have failed");
|
||||
box.setText("No node accepted the transaction broadcast. If Tor is "
|
||||
"still starting (or unavailable), the transaction may not "
|
||||
"reach the network at all.");
|
||||
box.setInformativeText("Rebroadcasting later is always safe: a "
|
||||
"transaction can never be spent twice.");
|
||||
QPushButton *retry = box.addButton("Rebroadcast now", QMessageBox::YesRole);
|
||||
box.addButton("Later", QMessageBox::RejectRole);
|
||||
box.exec();
|
||||
if (box.clickedButton() == retry) {
|
||||
this->onResendTransaction(txids[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::checkStuckTransactions() {
|
||||
// wowlet: a pending outgoing tx unconfirmed for this long has, in
|
||||
// practice, not reached the network (Tor down at send time, embedded
|
||||
// node restarted mid-relay). Local history scan only; no network calls,
|
||||
// and no txid is ever looked up against any external service. The remedy
|
||||
// reuses the existing rebroadcast path, which reconnects to a fresh node
|
||||
// first.
|
||||
constexpr qint64 kStuckSecs = 25 * 60;
|
||||
if (m_wallet == nullptr || m_wallet->history() == nullptr) {
|
||||
return;
|
||||
}
|
||||
TransactionHistory *history = m_wallet->history();
|
||||
for (quint64 i = 0; i < history->count(); i++) {
|
||||
const TransactionRow &row = history->transaction(static_cast<int>(i));
|
||||
if (!row.pending || row.direction == TransactionRow::Direction_In) {
|
||||
continue;
|
||||
}
|
||||
if (row.timestamp.secsTo(QDateTime::currentDateTime()) < kStuckSecs) {
|
||||
continue;
|
||||
}
|
||||
if (m_stuckTxWarned.contains(row.hash)) {
|
||||
continue;
|
||||
}
|
||||
m_stuckTxWarned.insert(row.hash);
|
||||
QMessageBox box(this);
|
||||
box.setWindowTitle("Transaction appears stuck");
|
||||
box.setText(QString("An outgoing transaction has been unconfirmed for "
|
||||
"more than %1 minutes:\n\n%2")
|
||||
.arg(kStuckSecs / 60).arg(row.hash));
|
||||
box.setInformativeText("It may never have reached the network. "
|
||||
"Rebroadcasting is safe: a transaction can "
|
||||
"never be spent twice, and your change stays "
|
||||
"locked until this either confirms or fails.");
|
||||
QPushButton *retry = box.addButton("Rebroadcast now", QMessageBox::YesRole);
|
||||
box.addButton("Later", QMessageBox::RejectRole);
|
||||
box.exec();
|
||||
if (box.clickedButton() == retry) {
|
||||
this->onResendTransaction(row.hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::relayPendingTransactions() {
|
||||
// wowlet: rebuild the multi-broadcast map from the wallet's own tx cache
|
||||
// for every pending outgoing tx and re-announce it. Strictly local
|
||||
// sources; the announcement itself goes through the normal (Tor-routed)
|
||||
// broadcast path.
|
||||
if (m_wallet == nullptr || m_wallet->history() == nullptr) {
|
||||
return;
|
||||
}
|
||||
TransactionHistory *history = m_wallet->history();
|
||||
QMap<QString, QString> txHexMap;
|
||||
for (quint64 i = 0; i < history->count(); i++) {
|
||||
const TransactionRow &row = history->transaction(static_cast<int>(i));
|
||||
if (!row.pending || row.direction == TransactionRow::Direction_In) {
|
||||
continue;
|
||||
}
|
||||
QString txHex = m_wallet->getCacheTransaction(row.hash);
|
||||
if (!txHex.isEmpty()) {
|
||||
txHexMap[row.hash] = txHex;
|
||||
}
|
||||
}
|
||||
if (txHexMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
qDebug() << QString("Re-relaying %1 pending transaction(s) after daemon sync").arg(txHexMap.size());
|
||||
this->onMultiBroadcast(txHexMap);
|
||||
}
|
||||
|
||||
void MainWindow::onSyncStatus(quint64 height, quint64 target, bool daemonSync) {
|
||||
|
||||
@@ -51,6 +51,9 @@ namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
#include <QSet>
|
||||
#include <QTimer>
|
||||
|
||||
class ToggleTab : QObject {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -214,12 +217,23 @@ private:
|
||||
QIcon hardwareDevicePairedIcon();
|
||||
QIcon hardwareDeviceUnpairedIcon();
|
||||
|
||||
// wowlet: stuck-transaction detection and pending re-relay. Both are
|
||||
// strictly local: history rows and the wallet's own tx cache; no txid is
|
||||
// ever queried against any external service.
|
||||
void checkStuckTransactions();
|
||||
void relayPendingTransactions();
|
||||
|
||||
QScopedPointer<Ui::MainWindow> ui;
|
||||
WindowManager *m_windowManager;
|
||||
Wallet *m_wallet = nullptr;
|
||||
Nodes *m_nodes;
|
||||
DaemonRpc *m_rpc;
|
||||
|
||||
// wowlet: see checkStuckTransactions / relayPendingTransactions
|
||||
QTimer *m_stuckTxTimer = nullptr;
|
||||
QSet<QString> m_stuckTxWarned;
|
||||
int m_broadcastBatchSuccesses = 0;
|
||||
|
||||
SplashDialog *m_splashDialog = nullptr;
|
||||
AccountSwitcherDialog *m_accountSwitcherDialog = nullptr;
|
||||
TxPoolViewerDialog *m_txPoolViewerDialog = nullptr;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "utils/DaemonManager.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QEventLoop>
|
||||
@@ -62,6 +63,11 @@ void DaemonManager::start() {
|
||||
if (state == QProcess::ProcessState::Running || state == QProcess::ProcessState::Starting)
|
||||
return;
|
||||
|
||||
// wowlet: a deliberate (re)start clears the stop latch, so a later UNEXPECTED exit can auto-restart
|
||||
// again. Without this, m_stopping stays true after the first node toggle-off and the crash
|
||||
// auto-restart is silently dead for the rest of the session.
|
||||
m_stopping = false;
|
||||
|
||||
if (!this->unpackBins()) {
|
||||
this->setErrorMessage("Unable to unpack the embedded wownerod binary.");
|
||||
return;
|
||||
@@ -85,6 +91,14 @@ void DaemonManager::start() {
|
||||
// and surfaces a clear error via handleProcessError().
|
||||
}
|
||||
|
||||
// wowlet: the retry cap guards against a rapid crash-loop, not legit restarts. If the node had been
|
||||
// up a while before this (re)start, clear the budget — otherwise a few node toggles over a session
|
||||
// trip "maximum retries exceeded" and it won't start again until wowlet is relaunched.
|
||||
const qint64 nowMs = QDateTime::currentMSecsSinceEpoch();
|
||||
if (m_lastSpawnMs != 0 && (nowMs - m_lastSpawnMs) > 60000)
|
||||
m_restarts = 0;
|
||||
m_lastSpawnMs = nowMs;
|
||||
|
||||
m_restarts += 1;
|
||||
if (m_restarts > 4) {
|
||||
this->setErrorMessage("wownerod failed to start: maximum retries exceeded");
|
||||
@@ -108,6 +122,14 @@ void DaemonManager::start() {
|
||||
arguments << "--no-igd"; // no UPnP port mapping
|
||||
arguments << "--out-peers" << "16";
|
||||
arguments << "--log-file" << QDir(dataDir).filePath("wownerod.log");
|
||||
// wowlet: disable LMDB batch write mode so every block is committed in its own transaction.
|
||||
// Without this, wownero accumulates blocks in a single large write transaction that is ABORTED
|
||||
// (not committed) when the daemon shuts down mid-sync — causing all progress since the last
|
||||
// batch boundary to be silently lost. This is visible in wownerod.log: sessions consistently
|
||||
// revert to a stale height despite a full graceful shutdown sequence. Using "safe" mode is
|
||||
// slower for initial sync but is the only correct choice for an embedded node that starts and
|
||||
// stops with the wallet; the wownero chain is small enough that the overhead is acceptable.
|
||||
arguments << "--db-sync-mode" << "safe";
|
||||
|
||||
// Full archival by default (wownero's chain is small); prune is an explicit opt-in.
|
||||
if (conf()->get(Config::pruneBlockchain).toBool())
|
||||
|
||||
@@ -73,6 +73,7 @@ private:
|
||||
bool m_synced = false;
|
||||
bool m_stopping = false;
|
||||
int m_restarts = 0;
|
||||
qint64 m_lastSpawnMs = 0; // wowlet: wall-clock of last spawn — ages out the crash-retry budget
|
||||
|
||||
static QPointer<DaemonManager> m_instance;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user