diff options
| author | Stéphane Gimenez <[email protected]> | 2011-06-27 23:22:30 +0200 |
|---|---|---|
| committer | Stéphane Gimenez <[email protected]> | 2011-06-27 23:22:30 +0200 |
| commit | 4d410cfce967a42cca7db13288b72baec29423d1 (patch) | |
| tree | cf81efbed4c5a9d8bc2ee56e752887befdd0760a /src/wallet.cpp | |
| parent | Merge pull request #347 from sipa/delkeyuser (diff) | |
| download | discoin-4d410cfce967a42cca7db13288b72baec29423d1.tar.xz discoin-4d410cfce967a42cca7db13288b72baec29423d1.zip | |
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 e35bce61e..e54bbb3f4 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) |