fix: use async api to checkNodeHealth (#2421)

This commit is contained in:
cyan
2025-07-31 19:49:17 +03:00
committed by GitHub
parent 8bf8c83f0e
commit 7468fed91b
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -175,7 +175,10 @@ int getNodeHeightSync() {
return cachedNodeHeight;
}
bool isConnectedSync() => currentWallet?.connected() != 0;
Future<bool> isConnected() async {
final wptrAddress = currentWallet!.ffiAddress();
return await Isolate.run(() => monero.Wallet_connected(Pointer.fromAddress(wptrAddress))) == 1;
}
Future<bool> setupNodeSync(
{required String address,
@@ -396,8 +399,6 @@ void startRefresh() => startRefreshSync();
Future<void> store() async => _storeSync(0);
Future<bool> isConnected() async => isConnectedSync();
Future<int> getNodeHeight() async => getNodeHeightSync();
void rescanBlockchainAsync() => currentWallet!.rescanBlockchainAsync();
+1 -1
View File
@@ -188,7 +188,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
Future<bool> checkNodeHealth() async {
try {
// Check if the wallet is currently connected to the daemon
final isConnected = monero_wallet.isConnectedSync();
final isConnected = await monero_wallet.isConnected();
if (!isConnected) {
return false; // It's not connected to daemon