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
committed by Andreas Schildbach
parent 85f8bfacd5
commit 78e724be3d

View File

@@ -2607,6 +2607,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
*/
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())) {
@@ -2624,6 +2625,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
}
return candidates;
} finally {
keychainLock.unlock();
lock.unlock();
}
}