{
cachedAddressTable.clear();
- CRITICAL_BLOCK(wallet->cs_KeyStore)
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
+ LOCK(wallet->cs_wallet);
BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, std::string)& item, wallet->mapAddressBook)
{
const CBitcoinAddress& address = item.first;
// Double-check that we're not overwriting a receiving address
if(rec->type == AddressTableEntry::Sending)
{
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
+ LOCK(wallet->cs_wallet);
// Remove old entry
wallet->DelAddressBookName(rec->address.toStdString());
// Add new entry with new address
}
}
-void AddressTableModel::updateList()
+void AddressTableModel::update()
{
// Update address book model from Bitcoin core
beginResetModel();
return QString();
}
// Check for duplicate addresses
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
+ LOCK(wallet->cs_wallet);
if(wallet->mapAddressBook.count(strAddress))
{
editStatus = DUPLICATE_ADDRESS;
editStatus = WALLET_UNLOCK_FAILURE;
return QString();
}
-
- strAddress = CBitcoinAddress(wallet->GetOrReuseKeyFromPool()).ToString();
+ std::vector<unsigned char> newKey;
+ if(!wallet->GetKeyFromPool(newKey, true))
+ {
+ editStatus = KEY_GENERATION_FAILURE;
+ return QString();
+ }
+ strAddress = CBitcoinAddress(newKey).ToString();
}
else
{
return QString();
}
- // Add entry and update list
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
+ // Add entry
+ {
+ LOCK(wallet->cs_wallet);
wallet->SetAddressBookName(strAddress, strLabel);
- updateList();
+ }
return QString::fromStdString(strAddress);
}
// Also refuse to remove receiving addresses.
return false;
}
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
+ LOCK(wallet->cs_wallet);
wallet->DelAddressBookName(rec->address.toStdString());
}
- updateList();
return true;
}
-void AddressTableModel::update()
-{
-
-}
-
/* Look up label for address in address book, if not found return empty string.
*/
QString AddressTableModel::labelForAddress(const QString &address) const
{
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
+ LOCK(wallet->cs_wallet);
CBitcoinAddress address_parsed(address.toStdString());
std::map<CBitcoinAddress, std::string>::iterator mi = wallet->mapAddressBook.find(address_parsed);
if (mi != wallet->mapAddressBook.end())