[skip ci] undo some changes

This commit is contained in:
Matthew Fosse 2024-10-24 09:00:20 -07:00
parent 7b276a3bc0
commit 7874675edd

View file

@ -447,14 +447,9 @@ class ElectrumClient {
final id = _id; final id = _id;
idCallback?.call(id); idCallback?.call(id);
_registryTask(id, completer); _registryTask(id, completer);
try { socket!.write(jsonrpc(method: method, id: id, params: params));
socket!.write(jsonrpc(method: method, id: id, params: params));
return completer.future; return completer.future;
} catch (e) {
print("call error: $e");
return null;
}
} }
Future<dynamic> callWithTimeout( Future<dynamic> callWithTimeout(
@ -468,6 +463,7 @@ class ElectrumClient {
final id = _id; final id = _id;
_registryTask(id, completer); _registryTask(id, completer);
socket!.write(jsonrpc(method: method, id: id, params: params)); socket!.write(jsonrpc(method: method, id: id, params: params));
await socket!.flush();
Timer(Duration(milliseconds: timeout), () { Timer(Duration(milliseconds: timeout), () {
if (!completer.isCompleted) { if (!completer.isCompleted) {
completer.completeError(RequestFailedTimeoutException(method, id)); completer.completeError(RequestFailedTimeoutException(method, id));
@ -476,8 +472,8 @@ class ElectrumClient {
return completer.future; return completer.future;
} catch (e) { } catch (e) {
print("callWithTimeout: $e"); print("callWithTimeout $e");
return null; rethrow;
} }
} }