diff options
author | luigi1111 <luigi1111w@gmail.com> | 2020-11-28 21:52:20 -0600 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2020-11-28 21:52:20 -0600 |
commit | 9b743e7c364254552bd27f67aa2123088d6f7d05 (patch) | |
tree | 5af8cfbf09510006ef45da4e5a8bb8ecf6633d2f | |
parent | Merge pull request #6826 (diff) | |
parent | Allow tx note edits via TransactionHistory object in wallet/api (diff) | |
download | monero-9b743e7c364254552bd27f67aa2123088d6f7d05.tar.xz |
Merge pull request #6829
016f36a Allow tx note edits via TransactionHistory object in wallet/api (dsc)
-rw-r--r-- | src/wallet/api/transaction_history.cpp | 11 | ||||
-rw-r--r-- | src/wallet/api/transaction_history.h | 1 | ||||
-rw-r--r-- | src/wallet/api/wallet2_api.h | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp index bcb300889..8bb15f39a 100644 --- a/src/wallet/api/transaction_history.cpp +++ b/src/wallet/api/transaction_history.cpp @@ -92,6 +92,17 @@ std::vector<TransactionInfo *> TransactionHistoryImpl::getAll() const return m_history; } +void TransactionHistoryImpl::setTxNote(const std::string &txid, const std::string ¬e) +{ + cryptonote::blobdata txid_data; + if(!epee::string_tools::parse_hexstr_to_binbuff(txid, txid_data) || txid_data.size() != sizeof(crypto::hash)) + return; + const crypto::hash htxid = *reinterpret_cast<const crypto::hash*>(txid_data.data()); + + m_wallet->m_wallet->set_tx_note(htxid, note); + refresh(); +} + void TransactionHistoryImpl::refresh() { // multithreaded access: diff --git a/src/wallet/api/transaction_history.h b/src/wallet/api/transaction_history.h index 8f3805788..60f12d771 100644 --- a/src/wallet/api/transaction_history.h +++ b/src/wallet/api/transaction_history.h @@ -45,6 +45,7 @@ public: virtual TransactionInfo * transaction(const std::string &id) const; virtual std::vector<TransactionInfo*> getAll() const; virtual void refresh(); + virtual void setTxNote(const std::string &txid, const std::string ¬e); private: diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index e8efc58b8..c871a8068 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -208,6 +208,7 @@ struct TransactionHistory virtual TransactionInfo * transaction(const std::string &id) const = 0; virtual std::vector<TransactionInfo*> getAll() const = 0; virtual void refresh() = 0; + virtual void setTxNote(const std::string &txid, const std::string ¬e) = 0; }; /** |