fix: (ba)nano testNetworkConnection always returning false

This commit is contained in:
julian 2023-06-07 12:28:11 -06:00
parent 479b0b333d
commit cb1922d2c7
2 changed files with 8 additions and 18 deletions

View file

@ -756,15 +756,10 @@ class BananoWallet extends CoinServiceAPI
}
@override
Future<bool> testNetworkConnection() {
http
.get(Uri.parse("${getCurrentNode().host}?action=version"))
.then((response) {
if (response.statusCode == 200) {
return true;
}
});
return Future.value(false);
Future<bool> testNetworkConnection() async {
final uri = Uri.parse("${getCurrentNode().host}?action=version");
final response = await http.get(uri);
return response.statusCode == 200;
}
Timer? _networkAliveTimer;

View file

@ -775,15 +775,10 @@ class NanoWallet extends CoinServiceAPI
}
@override
Future<bool> testNetworkConnection() {
http
.get(Uri.parse("${getCurrentNode().host}?action=version"))
.then((response) {
if (response.statusCode == 200) {
return true;
}
});
return Future.value(false);
Future<bool> testNetworkConnection() async {
final uri = Uri.parse("${getCurrentNode().host}?action=version");
final response = await http.get(uri);
return response.statusCode == 200;
}
Timer? _networkAliveTimer;