3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 10:45:51 +00:00

Wallet: take key chain lock not only wallet lock in getWatchedOutputs().

Flagged by the IntelliJ Inspector static analysis engine.
This commit is contained in:
Mike Hearn 2015-07-28 20:59:03 +02:00
parent b7c24c6196
commit d753d28ba5

View File

@ -2600,6 +2600,7 @@ public class Wallet extends BaseTaggableObject implements BlockChainListener, Pe
*/
public List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbases) {
lock.lock();
keychainLock.lock();
try {
LinkedList<TransactionOutput> candidates = Lists.newLinkedList();
for (Transaction tx : Iterables.concat(unspent.values(), pending.values())) {
@ -2617,6 +2618,7 @@ public class Wallet extends BaseTaggableObject implements BlockChainListener, Pe
}
return candidates;
} finally {
keychainLock.unlock();
lock.unlock();
}
}