add electrum_adapter ping note

This commit is contained in:
sneurlax 2024-02-16 16:46:24 -06:00
parent e2d8e80f66
commit c4cbf6eb5a

View file

@ -525,13 +525,21 @@ class ElectrumXClient {
/// Returns true if ping succeeded /// Returns true if ping succeeded
Future<bool> ping({String? requestID, int retryCount = 1}) async { Future<bool> ping({String? requestID, int retryCount = 1}) async {
try { try {
// This doesn't work because electrum_adapter only returns the result
// (which is always `null`).
// await checkElectrumAdapter();
// final response = await electrumAdapterClient!
// .ping()
// .timeout(const Duration(seconds: 2));
// return (response as Map<String, dynamic>).isNotEmpty;
final response = await request( final response = await request(
requestID: requestID, requestID: requestID,
command: 'server.ping', command: 'server.ping',
requestTimeout: const Duration(seconds: 2), requestTimeout: const Duration(seconds: 2),
retries: retryCount, retries: retryCount,
).timeout(const Duration(seconds: 2)) as Map<String, dynamic>; ).timeout(const Duration(seconds: 2)) as Map<String, dynamic>;
return response.isNotEmpty; // TODO [prio=extreme]: Fix this. return response.isNotEmpty;
} catch (e) { } catch (e) {
rethrow; rethrow;
} }