diff --git a/monero b/monero index 34aacb1..fedd2d2 160000 --- a/monero +++ b/monero @@ -1 +1 @@ -Subproject commit 34aacb1b49553f17b9bb7ca1ee6dfb6524aada55 +Subproject commit fedd2d2238c88a221b547b9fe2738dc0c18c5195 diff --git a/src/libwalletqt/AddressBook.cpp b/src/libwalletqt/AddressBook.cpp index 3ab84ef..15fd6e2 100644 --- a/src/libwalletqt/AddressBook.cpp +++ b/src/libwalletqt/AddressBook.cpp @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: 2020-2024 The Monero Project #include "AddressBook.h" -#include + #include AddressBook::AddressBook(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent) diff --git a/src/libwalletqt/AddressBook.h b/src/libwalletqt/AddressBook.h index 22c947d..a4ee0e4 100644 --- a/src/libwalletqt/AddressBook.h +++ b/src/libwalletqt/AddressBook.h @@ -4,7 +4,6 @@ #ifndef ADDRESSBOOK_H #define ADDRESSBOOK_H -#include #include #include #include diff --git a/src/libwalletqt/PassphraseHelper.h b/src/libwalletqt/PassphraseHelper.h index c678135..745ce50 100644 --- a/src/libwalletqt/PassphraseHelper.h +++ b/src/libwalletqt/PassphraseHelper.h @@ -4,7 +4,6 @@ #ifndef MONERO_GUI_PASSPHRASEHELPER_H #define MONERO_GUI_PASSPHRASEHELPER_H -#include #include #include #include diff --git a/src/libwalletqt/PendingTransactionInfo.h b/src/libwalletqt/PendingTransactionInfo.h index 7d00d1f..48135e3 100644 --- a/src/libwalletqt/PendingTransactionInfo.h +++ b/src/libwalletqt/PendingTransactionInfo.h @@ -4,7 +4,6 @@ #ifndef FEATHER_PENDINGTRANSACTIONINFO_H #define FEATHER_PENDINGTRANSACTIONINFO_H -#include #include "ConstructionInfo.h" #include #include diff --git a/src/libwalletqt/Subaddress.h b/src/libwalletqt/Subaddress.h index be799d9..7007baa 100644 --- a/src/libwalletqt/Subaddress.h +++ b/src/libwalletqt/Subaddress.h @@ -6,7 +6,6 @@ #include -#include #include #include #include diff --git a/src/libwalletqt/TransactionHistory.cpp b/src/libwalletqt/TransactionHistory.cpp index aaa543a..1714c72 100644 --- a/src/libwalletqt/TransactionHistory.cpp +++ b/src/libwalletqt/TransactionHistory.cpp @@ -11,6 +11,23 @@ #include "Ring.h" #include "wallet/wallet2.h" +QString description(tools::wallet2 *wallet2, const tools::wallet2::payment_details &pd) +{ + QString description = QString::fromStdString(wallet2->get_tx_note(pd.m_tx_hash)); + if (description.isEmpty()) { + if (pd.m_coinbase) { + description = "Coinbase"; + } + else if (pd.m_subaddr_index.major == 0 && pd.m_subaddr_index.minor == 0) { + description = "Primary address"; + } + else { + description = QString::fromStdString(wallet2->get_subaddress_label(pd.m_subaddr_index)); + } + } + return description; +} + bool TransactionHistory::transaction(int index, std::function callback) { QReadLocker locker(&m_lock); @@ -103,7 +120,7 @@ void TransactionHistory::refresh() t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp); t->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0; t->m_unlockTime = pd.m_unlock_time; - t->m_description = description(pd); + t->m_description = description(m_wallet2, pd); m_rows.append(t); } @@ -250,7 +267,7 @@ void TransactionHistory::refresh() t->m_label = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index)); t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp); t->m_confirmations = 0; - t->m_description = description(pd); + t->m_description = description(m_wallet2, pd); m_rows.append(t); @@ -384,21 +401,4 @@ bool TransactionHistory::writeCSV(const QString &path) { data = QString("blockHeight,timestamp,date,accountIndex,direction,balanceDelta,amount,fee,txid,description,paymentId,fiatAmount,fiatCurrency%1").arg(data); return Utils::fileWrite(path, data); -} - -QString TransactionHistory::description(const tools::wallet2::payment_details &pd) -{ - QString description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash)); - if (description.isEmpty()) { - if (pd.m_coinbase) { - description = "Coinbase"; - } - else if (pd.m_subaddr_index.major == 0 && pd.m_subaddr_index.minor == 0) { - description = "Primary address"; - } - else { - description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index)); - } - } - return description; } \ No newline at end of file diff --git a/src/libwalletqt/TransactionHistory.h b/src/libwalletqt/TransactionHistory.h index 24e60c6..ce10b8e 100644 --- a/src/libwalletqt/TransactionHistory.h +++ b/src/libwalletqt/TransactionHistory.h @@ -51,7 +51,6 @@ signals: private: explicit TransactionHistory(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent = nullptr); - QString description(const tools::wallet2::payment_details &pd); private: friend class Wallet; diff --git a/src/libwalletqt/UnsignedTransaction.h b/src/libwalletqt/UnsignedTransaction.h index 63df757..33e8723 100644 --- a/src/libwalletqt/UnsignedTransaction.h +++ b/src/libwalletqt/UnsignedTransaction.h @@ -6,7 +6,6 @@ #include -#include #include "libwalletqt/PendingTransactionInfo.h" class UnsignedTransaction : public QObject diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index c04701e..1b485e1 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -25,6 +25,8 @@ #include "utils/ScopeGuard.h" +#include "wallet/wallet2.h" + namespace { constexpr char ATTRIBUTE_SUBADDRESS_ACCOUNT[] = "feather.subaddress_account"; } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index d53dc72..df74afb 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -10,7 +10,6 @@ #include #include -#include "wallet/api/wallet2_api.h" #include "utils/scheduler.h" #include "PendingTransaction.h" #include "UnsignedTransaction.h" diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index 5f23443..c34fea4 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -5,7 +5,6 @@ #include "Wallet.h" #include "utils/ScopeGuard.h" -#include "serialization/binary_utils.h" class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver { @@ -329,45 +328,3 @@ void WalletManager::onPassphraseEntered(const QString &passphrase, bool enter_on m_passphraseReceiver->onPassphraseEntered(passphrase, enter_on_device, entry_abort); } } - -std::string WalletManager::encryptWithPassword(const QString &q_plain, const QString &q_password) { - std::string plain = q_plain.toStdString(); - std::string password = q_password.toStdString(); - - crypto::chacha_key key; - crypto::generate_chacha_key(password.data(), password.size(), key, 1); - - std::string cipher; - cipher.resize(plain.size()); - - // Repurposing this struct - tools::wallet2::keys_file_data s_data = {}; - s_data.iv = crypto::rand(); - - crypto::chacha20(plain.data(), plain.size(), key, s_data.iv, &cipher[0]); - s_data.account_data = cipher; - - std::string buf; - ::serialization::dump_binary(s_data, buf); - - return buf; -} - -QString WalletManager::decryptWithPassword(const std::string &cipher, const QString &q_password) { - std::string password = q_password.toStdString(); - - tools::wallet2::keys_file_data s_data; - bool r = ::serialization::parse_binary(cipher, s_data); - if (!r) { - return {}; - } - - crypto::chacha_key key; - crypto::generate_chacha_key(password.data(), password.size(), key, 1); - - std::string plaintext; - plaintext.resize(s_data.account_data.size()); - crypto::chacha20(s_data.account_data.data(), s_data.account_data.size(), key, s_data.iv, &plaintext[0]); - - return QString::fromStdString(plaintext); -} \ No newline at end of file diff --git a/src/libwalletqt/WalletManager.h b/src/libwalletqt/WalletManager.h index 74b3bb8..596a03f 100644 --- a/src/libwalletqt/WalletManager.h +++ b/src/libwalletqt/WalletManager.h @@ -117,9 +117,6 @@ public: void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort=false); virtual void onWalletPassphraseNeeded(bool on_device) override; - static std::string encryptWithPassword(const QString &plain, const QString &password); - static QString decryptWithPassword(const std::string &cipher, const QString &password); - signals: void walletOpened(Wallet *wallet); void walletCreated(Wallet *wallet); diff --git a/src/libwalletqt/rows/CoinsInfo.h b/src/libwalletqt/rows/CoinsInfo.h index 68b06ce..9cee507 100644 --- a/src/libwalletqt/rows/CoinsInfo.h +++ b/src/libwalletqt/rows/CoinsInfo.h @@ -4,7 +4,6 @@ #ifndef FEATHER_COINSINFO_H #define FEATHER_COINSINFO_H -#include #include #include #include