What changed, and why it matters
This commit simply removes an unused feature called TxFiatHistory from the Feather Wallet application. It deletes the code that maintained a local database of historical cryptocurrency-to-fiat exchange rates and the websocket command used to update it. There is no indication this change fixes a security vulnerability; it appears to be routine cleanup of dead code.
No security action required. Treat as routine code cleanup. If the feature is being removed permanently, ensure downstream documentation and release notes reflect the removal of historical fiat value lookup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the TxFiatHistory class and all its wiring. Deleted files: src/utils/TxFiatHistory.cpp and src/utils/TxFiatHistory.h. AppData no longer instantiates TxFiatHistory or connects websocket signals to it. WebsocketNotifier drops the ‘txFiatHistory’ command from its known command set and removes the TxFiatHistoryReceived signal. RestoreHeightLookup.h gains an explicit QDateTime include, likely a latent dependency exposed by the removal. No security-relevant behavior is introduced or patched.
Changed components
src/utils/TxFiatHistory.cppsrc/utils/TxFiatHistory.hsrc/utils/AppData.cppsrc/utils/AppData.hsrc/utils/WebsocketNotifier.cppsrc/utils/WebsocketNotifier.hsrc/utils/RestoreHeightLookup.hInspect captured patch +4 / −161
### src/utils/AppData.cpp
@@ -13,18 +13,8 @@ AppData::AppData(QObject *parent)
{
this->initRestoreHeights();
- auto genesis_timestamp = this->restoreHeights[NetworkType::Type::MAINNET]->data.firstKey();
- this->txFiatHistory = new TxFiatHistory(genesis_timestamp, Config::defaultConfigDir().path(), this);
-
- connect(websocketNotifier()->websocketClient, &WebsocketClient::connectionEstablished, this->txFiatHistory, &TxFiatHistory::onUpdateDatabase);
- connect(this->txFiatHistory, &TxFiatHistory::requestYear, [](int year){
- QByteArray data = QString(R"({"cmd": "txFiatHistory", "data": {"year": %1}})").arg(year).toUtf8();
- websocketNotifier()->websocketClient->sendMsg(data);
- });
-
connect(websocketNotifier(), &WebsocketNotifier::CryptoRatesReceived, &this->prices, &Prices::cryptoPricesReceived);
connect(websocketNotifier(), &WebsocketNotifier::FiatRatesReceived, &this->prices, &Prices::fiatPricesReceived);
- connect(websocketNotifier(), &WebsocketNotifier::TxFiatHistoryReceived, this->txFiatHistory, &TxFiatHistory::onWSData);
connect(websocketNotifier(), &WebsocketNotifier::BlockHeightsReceived, this, &AppData::onBlockHeightsReceived);
}
@@ -48,4 +38,4 @@ AppData* AppData::instance()
}
return m_instance;
-}
\ No newline at end of file
+}
### src/utils/AppData.h
@@ -8,7 +8,6 @@
#include <QPointer>
#include "prices.h"
-#include "TxFiatHistory.h"
#include "RestoreHeightLookup.h"
class AppData : public QObject {
@@ -19,7 +18,6 @@ Q_OBJECT
static AppData* instance();
Prices prices;
- TxFiatHistory *txFiatHistory;
QMap<NetworkType::Type, int> heights;
QMap<NetworkType::Type, RestoreHeightLookup*> restoreHeights;
### src/utils/RestoreHeightLookup.h
@@ -4,6 +4,8 @@
#ifndef FEATHER_RESTOREHEIGHTLOOKUP_H
#define FEATHER_RESTOREHEIGHTLOOKUP_H
+#include <QDateTime>
+
#include <cstdio>
#include <cstdlib>
### src/utils/TxFiatHistory.cpp
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: BSD-3-Clause
-// SPDX-FileCopyrightText: The Monero Project
-
-#include "TxFiatHistory.h"
-
-#include <QJsonObject>
-
-#include "utils/Utils.h"
-
-TxFiatHistory::TxFiatHistory(int genesis_timestamp, const QString &configDirectory, QObject *parent)
- : QObject(parent)
- , m_genesis_timestamp(genesis_timestamp)
- , m_databasePath(QString("%1/fiatHistory.db").arg(configDirectory))
-{
- this->loadDatabase();
-}
-
-double TxFiatHistory::get(int timestamp) {
- QDateTime ts;
- ts.setSecsSinceEpoch(timestamp);
- auto key = ts.toString("yyyyMMdd");
- return this->get(key); // USD
-}
-
-double TxFiatHistory::get(const QString &date) {
- if (m_database.contains(date)) {
- return m_database[date]; // USD
- }
- return 0.0;
-}
-
-void TxFiatHistory::loadDatabase() {
- if (!Utils::fileExists(m_databasePath)) {
- return;
- }
-
- m_database.clear();
-
- QString contents = Utils::barrayToString(Utils::fileOpen(m_databasePath));
- for (auto &line: contents.split("\n")) {
- line = line.trimmed();
- if (line.isEmpty()) {
- continue;
- }
- QStringList spl = line.split(":");
- if (spl.length() == 2) {
- m_database[spl.at(0)] = spl.at(1).toDouble();
- }
- }
-}
-
-void TxFiatHistory::writeDatabase() {
- QString data;
- for (const auto &line: m_database.toStdMap()) {
- data += QString("%1:%2\n").arg(line.first).arg(QString::number(line.second));
- }
- Utils::fileWrite(m_databasePath, data);
-}
-
-void TxFiatHistory::onUpdateDatabase() {
- // update local txFiatHistory database
- if (m_initialized) {
- return;
- }
-
- QDateTime genesis;
- genesis.setSecsSinceEpoch(m_genesis_timestamp);
- QDate genesis_date = genesis.date();
-
- QDate now = QDate::currentDate();
-
- QSet<int> missingYears;
- for (QDate date = genesis_date; date <= now;) {
-
- if (!m_database.contains(this->dateToKey(date))) {
- qInfo() << "TxFiatHistory: Can't find value for date: " << this->dateToKey(date);
- missingYears << date.year();
- date.setDate(date.year()+1, 1, 1);
- continue;
- }
-
- date = date.addDays(1);
- }
-
- for (const int year : missingYears) {
- emit requestYear(year);
- }
-
- m_initialized = true;
-}
-
-QString TxFiatHistory::dateToKey(const QDate &date) {
- return date.toString("yyyyMMdd");
-}
-
-void TxFiatHistory::onWSData(const QJsonObject &data) {
- foreach(const QString &key, data.keys()) {
- QJsonValue value = data.value(key);
- m_database[key] = value.toDouble();
- }
-
- this->writeDatabase();
-}
### src/utils/TxFiatHistory.h
@@ -1,37 +0,0 @@
-// SPDX-License-Identifier: BSD-3-Clause
-// SPDX-FileCopyrightText: The Monero Project
-
-#ifndef FEATHER_TXFIATHISTORY_H
-#define FEATHER_TXFIATHISTORY_H
-
-#include <QDate>
-#include <QObject>
-#include <QMap>
-
-class TxFiatHistory : public QObject {
- Q_OBJECT
-
-public:
- explicit TxFiatHistory(int genesis_timestamp, const QString &configDirectory, QObject *parent = nullptr);
- double get(const QString &date);
- double get(int timestamp);
-
-public slots:
- void onUpdateDatabase();
- void onWSData(const QJsonObject &data);
-
-signals:
- void requestYear(int year);
-
-private:
- void loadDatabase();
- void writeDatabase();
- QString dateToKey(const QDate &date);
-
- int m_genesis_timestamp;
- QString m_databasePath;
- bool m_initialized = false;
- QMap<QString, double> m_database;
-};
-
-#endif //FEATHER_TXFIATHISTORY_H
### src/utils/WebsocketNotifier.cpp
@@ -25,7 +25,7 @@ void WebsocketNotifier::onWSMessage(const QJsonObject &msg) {
QString cmd = msg.value("cmd").toString();
static const QSet<QString> knownCommands = {
- "blockheights", "nodes", "crypto_rates", "fiat_rates", "txFiatHistory", "updates"
+ "blockheights", "nodes", "crypto_rates", "fiat_rates", "updates"
};
if (!knownCommands.contains(cmd) && !m_pluginSubscriptions.contains(cmd)) {
@@ -57,11 +57,6 @@ void WebsocketNotifier::onWSMessage(const QJsonObject &msg) {
emit FiatRatesReceived(fiat_rates);
}
- else if(cmd == "txFiatHistory") {
- auto txFiatHistory_data = msg.value("data").toObject();
- emit TxFiatHistoryReceived(txFiatHistory_data);
- }
-
#if defined(CHECK_UPDATES)
else if (cmd == "updates") {
this->onWSUpdates(msg.value("data").toObject());
### src/utils/WebsocketNotifier.h
@@ -11,7 +11,6 @@
#include "networktype.h"
#include "nodes.h"
#include "prices.h"
-#include "TxFiatHistory.h"
class WebsocketNotifier : public QObject {
Q_OBJECT
@@ -33,7 +32,6 @@ class WebsocketNotifier : public QObject {
void NodesReceived(QList<FeatherNode> &L);
void CryptoRatesReceived(const QJsonArray &data);
void FiatRatesReceived(const QJsonObject &fiat_rates);
- void TxFiatHistoryReceived(const QJsonObject &data);
void UpdatesReceived(const QJsonObject &updates);
void dataReceived(const QString &type, const QJsonValue &json);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.