Skip to content

Commit

Permalink
Merge bitcoin#11733: qt: Remove redundant locks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jun 13, 2020
1 parent 69e76bd commit ef57921
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/qt/addresstablemodel.cpp
Expand Up @@ -393,11 +393,8 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
}

// Add entry
{
LOCK(wallet->cs_wallet);
wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
(type == Send ? "send" : "receive"));
}
wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
(type == Send ? "send" : "receive"));
return QString::fromStdString(strAddress);
}

Expand All @@ -411,10 +408,7 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent
// Also refuse to remove receiving addresses.
return false;
}
{
LOCK(wallet->cs_wallet);
wallet->DelAddressBook(DecodeDestination(rec->address.toStdString()));
}
wallet->DelAddressBook(DecodeDestination(rec->address.toStdString()));
return true;
}

Expand Down

0 comments on commit ef57921

Please sign in to comment.