qt: Handle address purpose in incremental updates
Correctly use the purpose of addresses that are added after the start of the client. Addresses with purpose "refund" and "change" should not be visible in the GUI. This is now handled correctly.
This commit is contained in:
@@ -1461,7 +1461,11 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const string& strNam
|
||||
{
|
||||
std::map<CTxDestination, CAddressBookData>::iterator mi = mapAddressBook.find(address);
|
||||
mapAddressBook[address].name = strName;
|
||||
NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED);
|
||||
if (!strPurpose.empty()) /* update purpose only if requested */
|
||||
mapAddressBook[address].purpose = strPurpose;
|
||||
NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address),
|
||||
mapAddressBook[address].purpose,
|
||||
(mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED);
|
||||
if (!fFileBacked)
|
||||
return false;
|
||||
if (!strPurpose.empty() && !CWalletDB(strWalletFile).WritePurpose(CBitcoinAddress(address).ToString(), strPurpose))
|
||||
@@ -1472,7 +1476,7 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const string& strNam
|
||||
bool CWallet::DelAddressBook(const CTxDestination& address)
|
||||
{
|
||||
mapAddressBook.erase(address);
|
||||
NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED);
|
||||
NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), "", CT_DELETED);
|
||||
if (!fFileBacked)
|
||||
return false;
|
||||
CWalletDB(strWalletFile).ErasePurpose(CBitcoinAddress(address).ToString());
|
||||
|
||||
Reference in New Issue
Block a user