Fix bug where updating would stop once coins were sent

This commit is contained in:
pokkst 2022-09-22 20:35:25 -05:00
parent 693b342393
commit 9187b9d8a4
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
2 changed files with 10 additions and 6 deletions

View File

@ -349,7 +349,9 @@ public class Wallet {
} }
public void refreshCoins() { public void refreshCoins() {
getCoins().refresh(); if(this.isSynchronized()) {
getCoins().refresh();
}
} }
private native long setListenerJ(WalletListener listener); private native long setListenerJ(WalletListener listener);

View File

@ -86,13 +86,13 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
@Override @Override
public void newBlock(long height) { public void newBlock(long height) {
refresh(); refresh(false);
BlockchainService.getInstance().setDaemonHeight(wallet.isSynchronized() ? height : 0); BlockchainService.getInstance().setDaemonHeight(wallet.isSynchronized() ? height : 0);
} }
@Override @Override
public void updated() { public void updated() {
refresh(); refresh(false);
} }
@Override @Override
@ -109,15 +109,17 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
BlockchainService.getInstance().setDaemonHeight(wallet.getDaemonBlockChainHeight()); BlockchainService.getInstance().setDaemonHeight(wallet.getDaemonBlockChainHeight());
wallet.setSynchronized(); wallet.setSynchronized();
wallet.store(); wallet.store();
refresh(); refresh(true);
} }
BlockchainService.getInstance().setConnectionStatus(status); BlockchainService.getInstance().setConnectionStatus(status);
} }
private void refresh() { private void refresh(boolean refreshCoins) {
wallet.refreshHistory(); wallet.refreshHistory();
wallet.refreshCoins(); if(refreshCoins) {
wallet.refreshCoins();
}
listener.onRefresh(); listener.onRefresh();
} }