diff --git a/lib/electrumx_rpc/rpc.dart b/lib/electrumx_rpc/rpc.dart index 4f72d469b..83d0ec6e4 100644 --- a/lib/electrumx_rpc/rpc.dart +++ b/lib/electrumx_rpc/rpc.dart @@ -27,6 +27,8 @@ class JsonRPC { void Function(List)? _onData; void Function(Object, StackTrace)? _onError; + List? _requestQueue; // TODO make Request model + Future request(String jsonRpcRequest) async { final completer = Completer(); final List responseData = []; @@ -39,7 +41,7 @@ class JsonRPC { if (data.last == 0x0A) { try { final response = json.decode(String.fromCharCodes(responseData)); - completer.complete(response); + completer.complete(response); // TODO only complete on last chunk? } catch (e, s) { Logging.instance .log("JsonRPC json.decode: $e\n$s", level: LogLevel.Error); @@ -89,7 +91,7 @@ class JsonRPC { if (useSSL) { socket ??= await SecureSocket.connect(host, port, - timeout: connectionTimeout, onBadCertificate: (_) => true); + timeout: connectionTimeout, onBadCertificate: (_) => true); // TODO do not automatically trust bad certificates _subscription ??= socket!.listen( _onData, onError: _onError,