mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-19 05:33:44 +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.
|
// Check if the balance already meets the given condition.
|
||||||
if (condition.matchBitcoins(wallet.getBalance(Wallet.BalanceType.ESTIMATED))) {
|
if (condition.matchBitcoins(wallet.getBalance(Wallet.BalanceType.ESTIMATED))) {
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
break;
|
} else {
|
||||||
}
|
Runnable onChange = () -> {
|
||||||
Runnable onChange = () -> {
|
synchronized (this) {
|
||||||
synchronized (this) {
|
saveWallet(walletFile);
|
||||||
saveWallet(walletFile);
|
Coin balance = wallet.getBalance(Wallet.BalanceType.ESTIMATED);
|
||||||
Coin balance = wallet.getBalance(Wallet.BalanceType.ESTIMATED);
|
if (condition.matchBitcoins(balance)) {
|
||||||
if (condition.matchBitcoins(balance)) {
|
System.out.println(balance.toFriendlyString());
|
||||||
System.out.println(balance.toFriendlyString());
|
latch.countDown();
|
||||||
latch.countDown();
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
wallet.addCoinsReceivedEventListener((w, t, p, n) -> onChange.run());
|
||||||
wallet.addCoinsReceivedEventListener((w, t, p, n) -> onChange.run());
|
wallet.addCoinsSentEventListener((w, t, p, n) -> onChange.run());
|
||||||
wallet.addCoinsSentEventListener((w, t, p, n) -> onChange.run());
|
wallet.addChangeEventListener(w -> onChange.run());
|
||||||
wallet.addChangeEventListener(w -> onChange.run());
|
wallet.addReorganizeEventListener(w -> onChange.run());
|
||||||
wallet.addReorganizeEventListener(w -> onChange.run());
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user