Fix AddressBook syncrhonization between a CWallet and CWalletDB

This problem was reported independently by laanwj in Issue #350.
This commit is contained in:
Stéphane Gimenez
2011-06-27 23:22:30 +02:00
parent d0d80170a2
commit 4d410cfce9
4 changed files with 45 additions and 16 deletions

View File

@@ -977,6 +977,24 @@ bool CWallet::LoadWallet(bool& fFirstRunRet)
return true;
}
bool CWallet::SetAddressBookName(const string& strAddress, const string& strName)
{
mapAddressBook[strAddress] = strName;
if (!fFileBacked)
return false;
return CWalletDB(strWalletFile).WriteName(strAddress, strName);
}
bool CWallet::DelAddressBookName(const string& strAddress)
{
mapAddressBook.erase(strAddress);
if (!fFileBacked)
return false;
return CWalletDB(strWalletFile).EraseName(strAddress);
}
void CWallet::PrintWallet(const CBlock& block)
{
CRITICAL_BLOCK(cs_mapWallet)