Skip to content

Commit

Permalink
Mark keypool as used if del rec address
Browse files Browse the repository at this point in the history
  • Loading branch information
presstab committed Feb 1, 2015
1 parent ddb325e commit b1af290
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qt/addresstablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex & paren
{
Q_UNUSED(parent);
AddressTableEntry *rec = priv->index(row);
if(count != 1 || !rec /*|| rec->type == AddressTableEntry::Receiving*/)
if(count != 1 || !rec )
{
// Can only remove one row at a time, and cannot remove rows not in model.
// Also refuse to remove receiving addresses.
Expand All @@ -366,7 +366,10 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex & paren
{
LOCK(wallet->cs_wallet);
wallet->DelAddressBookName(CBitcoinAddress(rec->address.toStdString()).Get());
//CWalletDB(wallet->strWalletFile).EraseName(CBitcoinAddress(rec->address.toStdString()).Get());
if(rec->type == AddressTableEntry::Receiving)
{
wallet->TopUpKeyPool(); //mark existing keypool as used and refill keypool
}
}
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ Value deleteaddress(const Array& params, bool fHelp)
string strAdd = params[0].get_str();

CWalletDB(pwalletMain->strWalletFile).EraseName(strAdd);
pwalletMain->TopUpKeyPool();

string ret = "Success, please restart wallet if using QT";
return ret;
Expand Down

0 comments on commit b1af290

Please sign in to comment.