From c4cbf6eb5a2322721005d03ce68b7005f334c9e3 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Fri, 16 Feb 2024 16:46:24 -0600 Subject: [PATCH] add electrum_adapter ping note --- lib/electrumx_rpc/electrumx_client.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/electrumx_rpc/electrumx_client.dart b/lib/electrumx_rpc/electrumx_client.dart index bddce3289..719f4bb59 100644 --- a/lib/electrumx_rpc/electrumx_client.dart +++ b/lib/electrumx_rpc/electrumx_client.dart @@ -525,13 +525,21 @@ class ElectrumXClient { /// Returns true if ping succeeded Future ping({String? requestID, int retryCount = 1}) async { 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).isNotEmpty; + final response = await request( requestID: requestID, command: 'server.ping', requestTimeout: const Duration(seconds: 2), retries: retryCount, ).timeout(const Duration(seconds: 2)) as Map; - return response.isNotEmpty; // TODO [prio=extreme]: Fix this. + return response.isNotEmpty; } catch (e) { rethrow; }