mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-10-01 01:35:48 -04:00
tolerate errors resuming from standby
This commit is contained in:
parent
7de40e2c33
commit
b3c607152d
@ -853,7 +853,12 @@ public class XmrWalletService {
|
||||
UserThread.execute(new Runnable() { // TODO (woodser): don't execute on UserThread
|
||||
@Override
|
||||
public void run() {
|
||||
balanceListener.onBalanceChanged(balance);
|
||||
try {
|
||||
balanceListener.onBalanceChanged(balance);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to notify balance listener of change");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1116,20 +1121,21 @@ public class XmrWalletService {
|
||||
|
||||
public BigInteger getAvailableBalanceForSubaddress(int subaddressIndex) {
|
||||
synchronized (walletLock) {
|
||||
if (wallet == null) throw new IllegalStateException("Cannot get available balance for subaddress because main wallet is null");
|
||||
return wallet.getUnlockedBalance(0, subaddressIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public BigInteger getBalance() {
|
||||
if (wallet == null) return BigInteger.valueOf(0);
|
||||
synchronized (walletLock) {
|
||||
if (wallet == null) throw new IllegalStateException("Cannot get balance because main wallet is null");
|
||||
return wallet.getBalance(0);
|
||||
}
|
||||
}
|
||||
|
||||
public BigInteger getAvailableBalance() {
|
||||
if (wallet == null) return BigInteger.valueOf(0);
|
||||
synchronized (walletLock) {
|
||||
if (wallet == null) throw new IllegalStateException("Cannot get available balance because main wallet is null");
|
||||
return wallet.getUnlockedBalance(0);
|
||||
}
|
||||
}
|
||||
|
@ -133,11 +133,18 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
||||
confirmationsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.confirmations")));
|
||||
usageColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.usage")));
|
||||
|
||||
// prefetch all incoming txs to avoid query per subaddress
|
||||
txsWithIncomingOutputs = xmrWalletService.getTxsWithIncomingOutputs();
|
||||
// try to initialize with wallet txs
|
||||
try {
|
||||
|
||||
// trigger creation of at least 1 address
|
||||
xmrWalletService.getFreshAddressEntry(txsWithIncomingOutputs);
|
||||
// prefetch all incoming txs to avoid query per subaddress
|
||||
txsWithIncomingOutputs = xmrWalletService.getTxsWithIncomingOutputs();
|
||||
|
||||
// trigger creation of at least 1 address
|
||||
xmrWalletService.getFreshAddressEntry(txsWithIncomingOutputs);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to get wallet txs to initialize DepositView");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
|
||||
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.deposit.noAddresses")));
|
||||
@ -237,7 +244,13 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
||||
tableView.getSelectionModel().selectedItemProperty().addListener(tableViewSelectionListener);
|
||||
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
|
||||
|
||||
updateList();
|
||||
// try to update deposits list
|
||||
try {
|
||||
updateList();
|
||||
} catch (Exception e) {
|
||||
log.warn("Could not update deposits list");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
xmrWalletService.addBalanceListener(balanceListener);
|
||||
xmrWalletService.addWalletListener(walletListener);
|
||||
|
@ -185,7 +185,14 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
||||
protected void activate() {
|
||||
sortedDisplayedTransactions.comparatorProperty().bind(tableView.comparatorProperty());
|
||||
tableView.setItems(sortedDisplayedTransactions);
|
||||
displayedTransactions.update();
|
||||
|
||||
// try to update displayed transactions
|
||||
try {
|
||||
displayedTransactions.update();
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to update displayed transactions");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
xmrWalletService.addWalletListener(transactionsUpdater);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user