Skip to content

Commit e782099

Browse files
committed
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
2 parents 6bb9c13 + d6f3a73 commit e782099

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/qt/addresstablemodel.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,8 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
393393
}
394394

395395
// Add entry
396-
{
397-
LOCK(wallet->cs_wallet);
398-
wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
399-
(type == Send ? "send" : "receive"));
400-
}
396+
wallet->SetAddressBook(DecodeDestination(strAddress), strLabel,
397+
(type == Send ? "send" : "receive"));
401398
return QString::fromStdString(strAddress);
402399
}
403400

@@ -411,10 +408,7 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent
411408
// Also refuse to remove receiving addresses.
412409
return false;
413410
}
414-
{
415-
LOCK(wallet->cs_wallet);
416-
wallet->DelAddressBook(DecodeDestination(rec->address.toStdString()));
417-
}
411+
wallet->DelAddressBook(DecodeDestination(rec->address.toStdString()));
418412
return true;
419413
}
420414

0 commit comments

Comments
 (0)