fix: use async api to checkNodeHealth (#2421)
cyan committed
Jul 31, 2025 at 12:49 UTC
7468fed91bb127e13f7955da8f056c79b8dde77b
2 files changed
+5
-4
cw_monero/lib/api/wallet.dart
+4
-3
@@ -175,7 +175,10 @@ int getNodeHeightSync() {
175
return cachedNodeHeight;
176
}
177
178
-bool isConnectedSync() => currentWallet?.connected() != 0;
178
+Future<bool> isConnected() async {
179
+ final wptrAddress = currentWallet!.ffiAddress();
180
+ return await Isolate.run(() => monero.Wallet_connected(Pointer.fromAddress(wptrAddress))) == 1;
181
+}
182
183
Future<bool> setupNodeSync(
184
{required String address,
@@ -396,8 +399,6 @@ void startRefresh() => startRefreshSync();
399
400
Future<void> store() async => _storeSync(0);
401
399
-Future<bool> isConnected() async => isConnectedSync();
400
-
402
Future<int> getNodeHeight() async => getNodeHeightSync();
403
404
void rescanBlockchainAsync() => currentWallet!.rescanBlockchainAsync();
cw_monero/lib/monero_wallet.dart
+1
-1
@@ -188,7 +188,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
188
Future<bool> checkNodeHealth() async {
189
try {
190
// Check if the wallet is currently connected to the daemon
191
- final isConnected = monero_wallet.isConnectedSync();
191
+ final isConnected = await monero_wallet.isConnected();
192
193
if (!isConnected) {
194
return false; // It's not connected to daemon