Wallet cache debug dialog

remotes/1691844314220217825/master
tobtoht 3 years ago
parent b7362b3125
commit 574b0ebf0c
Signed by untrusted user: tobtoht
GPG Key ID: 1CADD27F41F45C3C

@ -30,7 +30,7 @@ if(DEBUG)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
set(MONERO_HEAD "36cd38434a5198059c5898ff3968e86fd95e897d")
set(MONERO_HEAD "0b16332df67928dcab50131d236a9a94e59686ad")
set(BUILD_GUI_DEPS ON)
set(ARCH "x86-64")
set(BUILD_64 ON)

@ -1 +1 @@
Subproject commit 36cd38434a5198059c5898ff3968e86fd95e897d
Subproject commit 0b16332df67928dcab50131d236a9a94e59686ad

@ -0,0 +1,94 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include "WalletCacheDebugDialog.h"
#include "ui_WalletCacheDebugDialog.h"
#include <QRadioButton>
WalletCacheDebugDialog::WalletCacheDebugDialog(AppContext *ctx, QWidget *parent)
: QDialog(parent)
, m_ctx(ctx)
, ui(new Ui::WalletCacheDebugDialog)
{
ui->setupUi(this);
connect(ui->m_blockchain, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printBlockchain());
});
connect(ui->m_transfers, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printTransfers());
});
connect(ui->m_unconfirmed_payments, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printUnconfirmedPayments());
});
connect(ui->m_confirmed_txs, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printConfirmedTransferDetails());
});
connect(ui->m_unconfirmed_txs, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printUnconfirmedTransferDetails());
});
connect(ui->m_payments, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printPayments());
});
connect(ui->m_pub_keys, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printPubKeys());
});
connect(ui->m_tx_notes, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printTxNotes());
});
connect(ui->m_subaddresses, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printSubaddresses());
});
connect(ui->m_subaddress_labels, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printSubaddressLabels());
});
connect(ui->m_additional_tx_keys, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printAdditionalTxKeys());
});
connect(ui->m_attributes, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printAttributes());
});
connect(ui->m_key_images, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printKeyImages());
});
connect(ui->m_account_tags, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printAccountTags());
});
connect(ui->m_tx_keys, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printTxKeys());
});
connect(ui->m_address_book, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printAddressBook());
});
connect(ui->m_scanned_pool_txs, &QRadioButton::pressed, [this]{
this->setOutput(m_ctx->currentWallet->printScannedPoolTxs());
});
this->adjustSize();
}
void WalletCacheDebugDialog::setOutput(const QString &output) {
ui->output->setPlainText(output);
}
WalletCacheDebugDialog::~WalletCacheDebugDialog() {
delete ui;
}

@ -0,0 +1,30 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#ifndef FEATHER_WALLETCACHEDEBUGDIALOG_H
#define FEATHER_WALLETCACHEDEBUGDIALOG_H
#include <QDialog>
#include "appcontext.h"
namespace Ui {
class WalletCacheDebugDialog;
}
class WalletCacheDebugDialog : public QDialog
{
Q_OBJECT
public:
explicit WalletCacheDebugDialog(AppContext *ctx, QWidget *parent = nullptr);
~WalletCacheDebugDialog() override;
private:
void setOutput(const QString &output);
Ui::WalletCacheDebugDialog *ui;
AppContext *m_ctx;
};
#endif //FEATHER_WALLETCACHEDEBUGDIALOG_H

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WalletCacheDebugDialog</class>
<widget class="QDialog" name="WalletCacheDebugDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1423</width>
<height>814</height>
</rect>
</property>
<property name="windowTitle">
<string>Wallet Cache Debug</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPlainTextEdit" name="output">
<property name="minimumSize">
<size>
<width>500</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="m_blockchain">
<property name="text">
<string>m_blockchain</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_transfers">
<property name="text">
<string>m_transfers</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_key_images">
<property name="text">
<string>m_key_images</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_unconfirmed_txs">
<property name="text">
<string>m_unconfirmed_txs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_payments">
<property name="text">
<string>m_payments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_tx_keys">
<property name="text">
<string>m_tx_keys</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="m_confirmed_txs">
<property name="text">
<string>m_confirmed_txs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_tx_notes">
<property name="text">
<string>m_tx_notes</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_unconfirmed_payments">
<property name="text">
<string>m_unconfirmed_payments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_pub_keys">
<property name="text">
<string>m_pub_keys</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_address_book">
<property name="text">
<string>m_address_book</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_scanned_pool_txs">
<property name="text">
<string>m_scanned_pool_txs</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QRadioButton" name="m_subaddresses">
<property name="text">
<string>m_subaddresses</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_subaddress_labels">
<property name="text">
<string>m_subaddress_labels</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_additional_tx_keys">
<property name="text">
<string>m_additional_tx_keys</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_attributes">
<property name="text">
<string>m_attributes</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="m_account_tags">
<property name="text">
<string>m_account_tags</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>WalletCacheDebugDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>WalletCacheDebugDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -468,6 +468,91 @@ bool Wallet::importTransaction(const QString& txid, const QVector<quint64>& outp
double_spend_seen);
}
QString Wallet::printBlockchain()
{
return QString::fromStdString(m_walletImpl->printBlockchain());
}
QString Wallet::printTransfers()
{
return QString::fromStdString(m_walletImpl->printTransfers());
}
QString Wallet::printPayments()
{
return QString::fromStdString(m_walletImpl->printPayments());
}
QString Wallet::printUnconfirmedPayments()
{
return QString::fromStdString(m_walletImpl->printUnconfirmedPayments());
}
QString Wallet::printConfirmedTransferDetails()
{
return QString::fromStdString(m_walletImpl->printConfirmedTransferDetails());
}
QString Wallet::printUnconfirmedTransferDetails()
{
return QString::fromStdString(m_walletImpl->printUnconfirmedTransferDetails());
}
QString Wallet::printPubKeys()
{
return QString::fromStdString(m_walletImpl->printPubKeys());
}
QString Wallet::printTxNotes()
{
return QString::fromStdString(m_walletImpl->printTxNotes());
}
QString Wallet::printSubaddresses()
{
return QString::fromStdString(m_walletImpl->printSubaddresses());
}
QString Wallet::printSubaddressLabels()
{
return QString::fromStdString(m_walletImpl->printSubaddressLabels());
}
QString Wallet::printAdditionalTxKeys()
{
return QString::fromStdString(m_walletImpl->printAdditionalTxKeys());
}
QString Wallet::printAttributes()
{
return QString::fromStdString(m_walletImpl->printAttributes());
}
QString Wallet::printKeyImages()
{
return QString::fromStdString(m_walletImpl->printKeyImages());
}
QString Wallet::printAccountTags()
{
return QString::fromStdString(m_walletImpl->printAccountTags());
}
QString Wallet::printTxKeys()
{
return QString::fromStdString(m_walletImpl->printTxKeys());
}
QString Wallet::printAddressBook()
{
return QString::fromStdString(m_walletImpl->printAddressBook());
}
QString Wallet::printScannedPoolTxs()
{
return QString::fromStdString(m_walletImpl->printScannedPoolTxs());
}
void Wallet::startRefresh()
{
m_refreshEnabled = true;

@ -217,6 +217,24 @@ public:
//! import a transaction
Q_INVOKABLE bool importTransaction(const QString& txid, const QVector<quint64>& output_indeces, quint64 height, quint64 timestamp, bool miner_tx, bool pool, bool double_spend_seen);
Q_INVOKABLE QString printBlockchain();
Q_INVOKABLE QString printTransfers();
Q_INVOKABLE QString printPayments();
Q_INVOKABLE QString printUnconfirmedPayments();
Q_INVOKABLE QString printConfirmedTransferDetails();
Q_INVOKABLE QString printUnconfirmedTransferDetails();
Q_INVOKABLE QString printPubKeys();
Q_INVOKABLE QString printTxNotes();
Q_INVOKABLE QString printSubaddresses();
Q_INVOKABLE QString printSubaddressLabels();
Q_INVOKABLE QString printAdditionalTxKeys();
Q_INVOKABLE QString printAttributes();
Q_INVOKABLE QString printKeyImages();
Q_INVOKABLE QString printAccountTags();
Q_INVOKABLE QString printTxKeys();
Q_INVOKABLE QString printAddressBook();
Q_INVOKABLE QString printScannedPoolTxs();
//! refreshes the wallet
Q_INVOKABLE bool refresh(bool historyAndSubaddresses = false);

@ -19,6 +19,7 @@
#include "dialog/tximportdialog.h"
#include "dialog/passworddialog.h"
#include "dialog/balancedialog.h"
#include "dialog/WalletCacheDebugDialog.h"
#include "ui_mainwindow.h"
#include "globals.h"
@ -73,6 +74,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
connect(ui->actionQuit, &QAction::triggered, this, &MainWindow::menuQuitClicked);
connect(ui->actionSettings, &QAction::triggered, this, &MainWindow::menuSettingsClicked);
connect(ui->actionCalculator, &QAction::triggered, this, &MainWindow::showCalcWindow);
connect(ui->actionWallet_cache_debug, &QAction::triggered, this, &MainWindow::showWalletCacheDebugDialog);
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
ui->actionCreateDesktopEntry->setDisabled(true);
@ -1157,6 +1159,12 @@ void MainWindow::showDebugInfo() {
dialog->deleteLater();
}
void MainWindow::showWalletCacheDebugDialog() {
auto *dialog = new WalletCacheDebugDialog(m_ctx, this);
dialog->exec();
dialog->deleteLater();
}
void MainWindow::showNodeExhaustedMessage() {
// Spawning dialogs inside a lambda can cause system freezes on linux so we have to do it this way ¯\_(ツ)_/¯

@ -104,6 +104,7 @@ public slots:
void showViewOnlyDialog();
void donateButtonClicked();
void showCalcWindow();
void showWalletCacheDebugDialog();
void showSendTab();
void showHistoryTab();
void showSendScreen(const CCSEntry &entry);

@ -404,6 +404,7 @@
<addaction name="actionUpdate_balance"/>
<addaction name="actionRefresh_tabs"/>
<addaction name="actionRescan_spent"/>
<addaction name="actionWallet_cache_debug"/>
<addaction name="separator"/>
<addaction name="actionChange_restore_height"/>
<addaction name="menuExport"/>
@ -720,6 +721,11 @@
<string>Show Home</string>
</property>
</action>
<action name="actionWallet_cache_debug">
<property name="text">
<string>Wallet cache debug</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

Loading…
Cancel
Save