aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp2
-rw-r--r--src/wallet/wallet.h10
-rw-r--r--src/wallet/walletdb.cpp4
3 files changed, 12 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 6737270e52..6b061308ec 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3193,7 +3193,7 @@ bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& add
LOCK(cs_wallet);
std::map<CTxDestination, CAddressBookData>::iterator mi = m_address_book.find(address);
fUpdated = mi != m_address_book.end();
- m_address_book[address].name = strName;
+ m_address_book[address].SetLabel(strName);
if (!strPurpose.empty()) /* update purpose only if requested */
m_address_book[address].purpose = strPurpose;
}
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index c6f288a480..47268ba88c 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -181,14 +181,20 @@ public:
/** Address book data */
class CAddressBookData
{
+private:
+ std::string m_label;
public:
- std::string name;
+ const std::string& name;
std::string purpose;
- CAddressBookData() : purpose("unknown") {}
+ CAddressBookData() : name(m_label), purpose("unknown") {}
typedef std::map<std::string, std::string> StringMap;
StringMap destdata;
+
+ void SetLabel(const std::string& label) {
+ m_label = label;
+ }
};
struct CRecipient
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index 2e08a044da..568b21ed00 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -206,7 +206,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
if (strType == DBKeys::NAME) {
std::string strAddress;
ssKey >> strAddress;
- ssValue >> pwallet->m_address_book[DecodeDestination(strAddress)].name;
+ std::string label;
+ ssValue >> label;
+ pwallet->m_address_book[DecodeDestination(strAddress)].SetLabel(label);
} else if (strType == DBKeys::PURPOSE) {
std::string strAddress;
ssKey >> strAddress;