mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Fixes for gray screen bug.
This commit is contained in:
@@ -19,6 +19,7 @@ import 'package:cake_wallet/entities/wallet_info.dart';
|
||||
import 'package:cake_wallet/entities/node.dart';
|
||||
import 'package:cake_wallet/entities/transaction_priority.dart';
|
||||
|
||||
|
||||
part 'monero_wallet.g.dart';
|
||||
|
||||
const moneroBlockSize = 1000;
|
||||
@@ -40,6 +41,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
subaddress = subaddressList.subaddresses.first;
|
||||
address = subaddress.address;
|
||||
});
|
||||
_cachedRefreshHeight = 0;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -80,6 +82,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
String _filename;
|
||||
SyncListner _listener;
|
||||
ReactionDisposer _onAccountChangeReaction;
|
||||
int _cachedRefreshHeight;
|
||||
|
||||
Future<void> init() async {
|
||||
await accountList.update();
|
||||
@@ -177,7 +180,9 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
|
||||
@override
|
||||
Future<void> save() async {
|
||||
print('SAVE CALLED');
|
||||
await monero_wallet.store();
|
||||
print('SAVE FINISHED');
|
||||
}
|
||||
|
||||
Future<int> getNodeHeight() async => monero_wallet.getNodeHeight();
|
||||
@@ -191,12 +196,15 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
|
||||
@override
|
||||
Future<void> rescan({int height}) async {
|
||||
walletInfo.restoreHeight = height;
|
||||
walletInfo.isRecovery = true;
|
||||
monero_wallet.setRefreshFromBlockHeight(height: height);
|
||||
monero_wallet.rescanBlockchainAsync();
|
||||
await startSync();
|
||||
_askForUpdateBalance();
|
||||
await _askForUpdateTransactionHistory();
|
||||
await save();
|
||||
await walletInfo.save();
|
||||
}
|
||||
|
||||
void _setListeners() {
|
||||
@@ -284,7 +292,10 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance> with Store {
|
||||
await setAsRecovered();
|
||||
}
|
||||
|
||||
await save();
|
||||
if (currentHeight - _cachedRefreshHeight > moneroBlockSize) {
|
||||
_cachedRefreshHeight = currentHeight;
|
||||
await save();
|
||||
}
|
||||
}
|
||||
|
||||
void _onNewTransaction() {
|
||||
|
||||
Reference in New Issue
Block a user