rec->label = value.toString();
break;
case Address:
- // Refuse to set invalid address
+ // Refuse to set invalid address, set error status and return false
if(!walletModel->validateAddress(value.toString()))
{
editStatus = INVALID_ADDRESS;
return false;
}
- // Double-check that we're not overwriting receiving address
+ // Double-check that we're not overwriting a receiving address
if(rec->type == AddressTableEntry::Sending)
{
CRITICAL_BLOCK(wallet->cs_mapAddressBook)
void AddressTableModel::updateList()
{
- // Update internal model from Bitcoin core
+ // Update address book model from Bitcoin core
beginResetModel();
priv->refreshAddressTable();
endResetModel();
editStatus = OK;
-
if(type == Send)
{
if(!walletModel->validateAddress(address))
editStatus = INVALID_ADDRESS;
return QString();
}
- // Check for duplicate
+ // Check for duplicate addresses
CRITICAL_BLOCK(wallet->cs_mapAddressBook)
{
if(wallet->mapAddressBook.count(strAddress))
else if(type == Receive)
{
// Generate a new address to associate with given label
+ WalletModel::UnlockContext ctx(walletModel->requestUnlock());
+ if(!ctx.isValid())
+ {
+ // Unlock wallet failed or was cancelled
+ editStatus = WALLET_UNLOCK_FAILURE;
+ return QString();
+ }
+
strAddress = CBitcoinAddress(wallet->GetOrReuseKeyFromPool()).ToString();
}
else