mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Fix unavailable balance not refreshing after the app got opened (#1920)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user