aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authordsc <dsc@xmr.pm>2020-09-19 21:43:18 +0200
committerselsta <selsta@sent.at>2021-04-22 04:32:14 +0200
commit153d08d026c0d09b57a78521d3c4d7f229c58a99 (patch)
tree13d7063aacea86872fa7a299e5e9f71abb5a2a52 /src/wallet
parentwallet_api: TransactionHistory - fill unconfirmed out payments dests (diff)
downloadmonero-153d08d026c0d09b57a78521d3c4d7f229c58a99.tar.xz
Allow tx note edits via TransactionHistory object in wallet/api
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/api/transaction_history.cpp11
-rw-r--r--src/wallet/api/transaction_history.h1
-rw-r--r--src/wallet/api/wallet2_api.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/api/transaction_history.cpp b/src/wallet/api/transaction_history.cpp
index 3743f74ad..b6d52c58d 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 &note)
+{
+ 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 &note);
private:
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index cf48d1dd1..44928a422 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -210,6 +210,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 &note) = 0;
};
/**