aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-02-22 05:02:18 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-04-02 16:37:42 +0000
commitb5795a788639305bab86a8b3f6b75d6ce81be083 (patch)
tree90081729d4ba7aafcf829c3be555e36bc065b03e /src/wallet
parent6d2905f57aaeb3ec3b63d31043f7673ca10003f2 (diff)
Wallet: Add warning comments and assert to CWallet::DelAddressBook
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp5
-rw-r--r--src/wallet/wallet.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index b4cbcfd005..9538f4f2b7 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3213,6 +3213,11 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const std::string& s
bool CWallet::DelAddressBook(const CTxDestination& address)
{
+ // If we want to delete receiving addresses, we need to take care that DestData "used" (and possibly newer DestData) gets preserved (and the "deleted" address transformed into a change entry instead of actually being deleted)
+ // NOTE: This isn't a problem for sending addresses because they never have any DestData yet!
+ // When adding new DestData, it should be considered here whether to retain or delete it (or move it?).
+ assert(!IsMine(address));
+
{
LOCK(cs_wallet);
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index c681dd28c8..7e770a40f2 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -852,7 +852,10 @@ public:
bool LoadMinVersion(int nVersion) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; }
- //! Adds a destination data tuple to the store, and saves it to disk
+ /**
+ * Adds a destination data tuple to the store, and saves it to disk
+ * When adding new fields, take care to consider how DelAddressBook should handle it!
+ */
bool AddDestData(WalletBatch& batch, const CTxDestination& dest, const std::string& key, const std::string& value) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
//! Erases a destination data tuple in the store and on disk
bool EraseDestData(WalletBatch& batch, const CTxDestination& dest, const std::string& key) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);