mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 02:24:30 +00:00
add electrum_adapter ping note
This commit is contained in:
parent
e2d8e80f66
commit
c4cbf6eb5a
1 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue