|
|
|
@ -192,7 +192,7 @@ void CWallet::SetBestChain(const CBlockLocator& loc)
@@ -192,7 +192,7 @@ void CWallet::SetBestChain(const CBlockLocator& loc)
|
|
|
|
|
|
|
|
|
|
bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn, bool fExplicit) |
|
|
|
|
{ |
|
|
|
|
AssertLockHeld(cs_wallet); // nWalletVersion
|
|
|
|
|
LOCK(cs_wallet); // nWalletVersion
|
|
|
|
|
if (nWalletVersion >= nVersion) |
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
@ -219,7 +219,7 @@ bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn,
@@ -219,7 +219,7 @@ bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB* pwalletdbIn,
|
|
|
|
|
|
|
|
|
|
bool CWallet::SetMaxVersion(int nVersion) |
|
|
|
|
{ |
|
|
|
|
AssertLockHeld(cs_wallet); // nWalletVersion, nWalletMaxVersion
|
|
|
|
|
LOCK(cs_wallet); // nWalletVersion, nWalletMaxVersion
|
|
|
|
|
// cannot downgrade below current version
|
|
|
|
|
if (nWalletVersion > nVersion) |
|
|
|
|
return false; |
|
|
|
@ -1621,14 +1621,17 @@ DBErrors CWallet::ZapWalletTx()
@@ -1621,14 +1621,17 @@ DBErrors CWallet::ZapWalletTx()
|
|
|
|
|
|
|
|
|
|
bool CWallet::SetAddressBook(const CTxDestination& address, const string& strName, const string& strPurpose) |
|
|
|
|
{ |
|
|
|
|
AssertLockHeld(cs_wallet); // mapAddressBook
|
|
|
|
|
bool fUpdated = false; |
|
|
|
|
{ |
|
|
|
|
LOCK(cs_wallet); // mapAddressBook
|
|
|
|
|
std::map<CTxDestination, CAddressBookData>::iterator mi = mapAddressBook.find(address); |
|
|
|
|
fUpdated = mi != mapAddressBook.end(); |
|
|
|
|
mapAddressBook[address].name = strName; |
|
|
|
|
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); |
|
|
|
|
strPurpose, (fUpdated ? CT_UPDATED : CT_NEW) ); |
|
|
|
|
if (!fFileBacked) |
|
|
|
|
return false; |
|
|
|
|
if (!strPurpose.empty() && !CWalletDB(strWalletFile).WritePurpose(CBitcoinAddress(address).ToString(), strPurpose)) |
|
|
|
@ -1638,8 +1641,8 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const string& strNam
@@ -1638,8 +1641,8 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const string& strNam
|
|
|
|
|
|
|
|
|
|
bool CWallet::DelAddressBook(const CTxDestination& address) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
AssertLockHeld(cs_wallet); // mapAddressBook
|
|
|
|
|
{ |
|
|
|
|
LOCK(cs_wallet); // mapAddressBook
|
|
|
|
|
|
|
|
|
|
if(fFileBacked) |
|
|
|
|
{ |
|
|
|
@ -1650,9 +1653,11 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
@@ -1650,9 +1653,11 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
|
|
|
|
|
CWalletDB(strWalletFile).EraseDestData(strAddress, item.first); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
mapAddressBook.erase(address); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), "", CT_DELETED); |
|
|
|
|
|
|
|
|
|
if (!fFileBacked) |
|
|
|
|
return false; |
|
|
|
|
CWalletDB(strWalletFile).ErasePurpose(CBitcoinAddress(address).ToString()); |
|
|
|
|