mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
WalletTool: use an else
branch rather than break
(from a case
)
This commit is contained in:
parent
021ace195f
commit
d65aefd93e
@ -945,22 +945,22 @@ public class WalletTool implements Callable<Integer> {
|
||||
// Check if the balance already meets the given condition.
|
||||
if (condition.matchBitcoins(wallet.getBalance(Wallet.BalanceType.ESTIMATED))) {
|
||||
latch.countDown();
|
||||
break;
|
||||
}
|
||||
Runnable onChange = () -> {
|
||||
synchronized (this) {
|
||||
saveWallet(walletFile);
|
||||
Coin balance = wallet.getBalance(Wallet.BalanceType.ESTIMATED);
|
||||
if (condition.matchBitcoins(balance)) {
|
||||
System.out.println(balance.toFriendlyString());
|
||||
latch.countDown();
|
||||
} else {
|
||||
Runnable onChange = () -> {
|
||||
synchronized (this) {
|
||||
saveWallet(walletFile);
|
||||
Coin balance = wallet.getBalance(Wallet.BalanceType.ESTIMATED);
|
||||
if (condition.matchBitcoins(balance)) {
|
||||
System.out.println(balance.toFriendlyString());
|
||||
latch.countDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
wallet.addCoinsReceivedEventListener((w, t, p, n) -> onChange.run());
|
||||
wallet.addCoinsSentEventListener((w, t, p, n) -> onChange.run());
|
||||
wallet.addChangeEventListener(w -> onChange.run());
|
||||
wallet.addReorganizeEventListener(w -> onChange.run());
|
||||
};
|
||||
wallet.addCoinsReceivedEventListener((w, t, p, n) -> onChange.run());
|
||||
wallet.addCoinsSentEventListener((w, t, p, n) -> onChange.run());
|
||||
wallet.addChangeEventListener(w -> onChange.run());
|
||||
wallet.addReorganizeEventListener(w -> onChange.run());
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user