mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Wallet: Require usage of new CAddressBookData::setLabel to change label
This commit is contained in:
parent
b86cd155f6
commit
144b2f85da
3 changed files with 12 additions and 4 deletions
|
|
@ -3193,7 +3193,7 @@ bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& add
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
std::map<CTxDestination, CAddressBookData>::iterator mi = m_address_book.find(address);
|
std::map<CTxDestination, CAddressBookData>::iterator mi = m_address_book.find(address);
|
||||||
fUpdated = mi != m_address_book.end();
|
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 */
|
if (!strPurpose.empty()) /* update purpose only if requested */
|
||||||
m_address_book[address].purpose = strPurpose;
|
m_address_book[address].purpose = strPurpose;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -181,14 +181,20 @@ public:
|
||||||
/** Address book data */
|
/** Address book data */
|
||||||
class CAddressBookData
|
class CAddressBookData
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
std::string m_label;
|
||||||
public:
|
public:
|
||||||
std::string name;
|
const std::string& name;
|
||||||
std::string purpose;
|
std::string purpose;
|
||||||
|
|
||||||
CAddressBookData() : purpose("unknown") {}
|
CAddressBookData() : name(m_label), purpose("unknown") {}
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> StringMap;
|
typedef std::map<std::string, std::string> StringMap;
|
||||||
StringMap destdata;
|
StringMap destdata;
|
||||||
|
|
||||||
|
void SetLabel(const std::string& label) {
|
||||||
|
m_label = label;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CRecipient
|
struct CRecipient
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,9 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||||
if (strType == DBKeys::NAME) {
|
if (strType == DBKeys::NAME) {
|
||||||
std::string strAddress;
|
std::string strAddress;
|
||||||
ssKey >> 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) {
|
} else if (strType == DBKeys::PURPOSE) {
|
||||||
std::string strAddress;
|
std::string strAddress;
|
||||||
ssKey >> strAddress;
|
ssKey >> strAddress;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue