Merge #11733: qt: Remove redundant locks

d6f3a73 Remove redundant locks (practicalswift)

Pull request description:

  Remove redundant locks:
  * ~~`FindNode(...)` is locking `cs_vNodes` internally~~
  * `SetAddressBook(...)` is locking `cs_wallet` internally
  * `DelAddressBook(...)` is locking `cs_wallet` internally

  **Note to reviewers:** From what I can tell these locks are redundantly held from a data integrity perspective (guarding specific variables), and they do not appear to be needed from a data consistency perspective (ensuring a consistent state at the right points). Review thoroughly and please let me know if I'm mistaken :-)

Tree-SHA512: 7e3ca2d52fecb16385dc65051b5b20d81b502c0025d70b0c489eb3881866bdd57947a9c96931f7b213f5a8a76b6d2c7b084dff0ef2028a1e9ca9ccfd83e5b91e
This commit is contained in:
Wladimir J. van der Laan 2018-02-14 17:25:57 +01:00
commit e782099a15
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D

View file

@ -393,11 +393,8 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
} }
// Add entry // Add entry
{ wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
LOCK(wallet->cs_wallet); (type == Send ? "send" : "receive"));
wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
(type == Send ? "send" : "receive"));
}
return QString::fromStdString(strAddress); return QString::fromStdString(strAddress);
} }
@ -411,10 +408,7 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent
// Also refuse to remove receiving addresses. // Also refuse to remove receiving addresses.
return false; return false;
} }
{ wallet->DelAddressBook(DecodeDestination(rec->address.toStdString()));
LOCK(wallet->cs_wallet);
wallet->DelAddressBook(DecodeDestination(rec->address.toStdString()));
}
return true; return true;
} }