Skip to content

Commit

Permalink
Wallet: take key chain lock not only wallet lock in getWatchedOutputs().
Browse files Browse the repository at this point in the history
Flagged by the IntelliJ Inspector static analysis engine.
  • Loading branch information
mikehearn committed Jul 28, 2015
1 parent b7c24c6 commit d753d28
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/java/org/bitcoinj/core/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,7 @@ private void clearTransactions() {
*/
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())) {
Expand All @@ -2617,6 +2618,7 @@ public List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbase
}
return candidates;
} finally {
keychainLock.unlock();
lock.unlock();
}
}
Expand Down

0 comments on commit d753d28

Please sign in to comment.