add getBlockHeadTip response/error checking

This commit is contained in:
Josh Babb 2023-05-24 16:05:59 -05:00
parent d8a7c8d5ad
commit 3cb894e7c6

View file

@ -310,6 +310,13 @@ class ElectrumX {
requestID: requestID, requestID: requestID,
command: 'blockchain.headers.subscribe', command: 'blockchain.headers.subscribe',
); );
if (response["result"] == null) {
Logging.instance.log(
"getBlockHeadTip returned null response",
level: LogLevel.Error,
);
throw 'getBlockHeadTip returned null response';
}
return Map<String, dynamic>.from(response["result"] as Map); return Map<String, dynamic>.from(response["result"] as Map);
} catch (e) { } catch (e) {
rethrow; rethrow;