mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 14:50:57 +01: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:
parent
b7c24c6196
commit
d753d28ba5
1 changed files with 2 additions and 0 deletions
|
@ -2600,6 +2600,7 @@ public class Wallet extends BaseTaggableObject implements BlockChainListener, Pe
|
||||||
*/
|
*/
|
||||||
public List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbases) {
|
public List<TransactionOutput> getWatchedOutputs(boolean excludeImmatureCoinbases) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
|
keychainLock.lock();
|
||||||
try {
|
try {
|
||||||
LinkedList<TransactionOutput> candidates = Lists.newLinkedList();
|
LinkedList<TransactionOutput> candidates = Lists.newLinkedList();
|
||||||
for (Transaction tx : Iterables.concat(unspent.values(), pending.values())) {
|
for (Transaction tx : Iterables.concat(unspent.values(), pending.values())) {
|
||||||
|
@ -2617,6 +2618,7 @@ public class Wallet extends BaseTaggableObject implements BlockChainListener, Pe
|
||||||
}
|
}
|
||||||
return candidates;
|
return candidates;
|
||||||
} finally {
|
} finally {
|
||||||
|
keychainLock.unlock();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue