Warm up wallet refresh after node connect
This commit is contained in:
@@ -322,6 +322,7 @@ class MoneroCBackend implements WalletBackend {
|
||||
peya.Wallet_setTrustedDaemon(_wallet!, arg: trusted);
|
||||
_ensureStoreTxInfoEnabled();
|
||||
_startBackgroundSync();
|
||||
await _warmUpRefresh();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -367,6 +368,20 @@ class MoneroCBackend implements WalletBackend {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _warmUpRefresh() async {
|
||||
_ensureWallet();
|
||||
if (_rescanInProgress || !_walletInitialized) {
|
||||
return;
|
||||
}
|
||||
final walletAddress = _wallet!.address;
|
||||
final libPath = peya.libPath;
|
||||
try {
|
||||
await Isolate.run(() => _refreshWalletNowJob(walletAddress, libPath));
|
||||
} catch (error) {
|
||||
_logger.w('Warm-up refresh failed: $error');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> rescanBlockchain({int? fromHeight}) async {
|
||||
_ensureWallet();
|
||||
@@ -1160,6 +1175,13 @@ void _refreshJob(int walletAddress, String libPath) {
|
||||
peya.Coins_refresh(coins);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void _refreshWalletNowJob(int walletAddress, String libPath) {
|
||||
peya.libPath = libPath;
|
||||
final wallet = Pointer<Void>.fromAddress(walletAddress);
|
||||
peya.Wallet_refresh(wallet);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
Map<String, StakeYieldInfo> _loadActiveStakeYieldsJob(
|
||||
int walletAddress,
|
||||
|
||||
Reference in New Issue
Block a user