diff options
author | Stéphane Gimenez <dev@gim.name> | 2011-06-27 23:22:30 +0200 |
---|---|---|
committer | Stéphane Gimenez <dev@gim.name> | 2011-06-27 23:22:30 +0200 |
commit | 4d410cfce967a42cca7db13288b72baec29423d1 (patch) | |
tree | cf81efbed4c5a9d8bc2ee56e752887befdd0760a /src/wallet.cpp | |
parent | d0d80170a2ca73004e08fb85007fe055cbf4e411 (diff) |
Fix AddressBook syncrhonization between a CWallet and CWalletDB
This problem was reported independently by laanwj in Issue #350.
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r-- | src/wallet.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp index e35bce61ef..e54bbb3f45 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -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) |