Wallet: Require usage of new CAddressBookData::setLabel to change label

This commit is contained in:
Luke Dashjr committed 2020-04-02 16:01:36 +00:00
1 parent b86cd155f6
commit 144b2f85da
3 files changed
+12 -4

No files matched your search

+1 -1
View File
@@ -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;
}
+8 -2
View File
@@ -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
+3 -1
View File
@@ -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;