mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-18 16:55:58 +00:00
Fix unavailable balance not refreshing after the app got opened
This commit is contained in:
parent
26c1f0b85c
commit
899b41f40a
2 changed files with 6 additions and 1 deletions
|
@ -503,6 +503,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
}
|
||||
|
||||
Future<void> updateUnspent() async {
|
||||
await transaction_history.txHistoryMutex.acquire();
|
||||
try {
|
||||
refreshCoins(walletAddresses.account!.id);
|
||||
|
||||
|
@ -531,6 +532,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
|
||||
if (unspentCoinsInfo.isEmpty) {
|
||||
unspentCoins.forEach((coin) => _addCoinInfo(coin));
|
||||
transaction_history.txHistoryMutex.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -555,7 +557,9 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
|
||||
await _refreshUnspentCoinsInfo();
|
||||
_askForUpdateBalance();
|
||||
transaction_history.txHistoryMutex.release();
|
||||
} catch (e, s) {
|
||||
transaction_history.txHistoryMutex.release();
|
||||
printV(e.toString());
|
||||
onError?.call(FlutterErrorDetails(
|
||||
exception: e,
|
||||
|
|
|
@ -12,6 +12,7 @@ import 'package:cw_core/wallet_info.dart';
|
|||
import 'package:cw_core/wallet_service.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cw_monero/api/account_list.dart';
|
||||
import 'package:cw_monero/api/transaction_history.dart';
|
||||
import 'package:cw_monero/api/wallet_manager.dart' as monero_wallet_manager;
|
||||
import 'package:cw_monero/api/wallet_manager.dart';
|
||||
import 'package:cw_monero/ledger.dart';
|
||||
|
@ -159,7 +160,7 @@ class MoneroWalletService extends WalletService<
|
|||
}
|
||||
|
||||
await wallet.init();
|
||||
|
||||
await wallet.updateUnspent();
|
||||
return wallet;
|
||||
} catch (e) {
|
||||
// TODO: Implement Exception for wallet list service.
|
||||
|
|
Loading…
Reference in a new issue