mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
correct node testing logic
This commit is contained in:
parent
ecf56b21c0
commit
d68e416a74
1 changed files with 7 additions and 8 deletions
|
@ -65,13 +65,7 @@ Future<MoneroNodeConnectionResponse> testMoneroNodeConnection(
|
|||
return false;
|
||||
};
|
||||
|
||||
if (proxyInfo == null) {
|
||||
// If the host ends in .onion, we can't access it without Tor.
|
||||
if (uri.host.endsWith('.onion')) {
|
||||
return MoneroNodeConnectionResponse(null, null, null, false);
|
||||
}
|
||||
|
||||
// Proxyless connections can use an HttpClient; proxied ones cannot.
|
||||
if (!uri.host.endsWith(".onion")) {
|
||||
final request = await httpClient.postUrl(uri);
|
||||
|
||||
final body = utf8.encode(
|
||||
|
@ -101,7 +95,12 @@ Future<MoneroNodeConnectionResponse> testMoneroNodeConnection(
|
|||
// or we can check for certain values in the response to decide
|
||||
return MoneroNodeConnectionResponse(null, null, null, true);
|
||||
} else {
|
||||
// Proxied connections cannot use an HttpClient.
|
||||
if (proxyInfo == null) {
|
||||
// If the host ends in .onion, we can't access it without Tor.
|
||||
return MoneroNodeConnectionResponse(null, null, null, false);
|
||||
}
|
||||
|
||||
// An HttpClient cannot be used for onion nodes.
|
||||
//
|
||||
// The SOCKSSocket class from the tor_ffi_plugin package can be used to
|
||||
// connect to .onion addresses. We'll do the same things as above but
|
||||
|
|
Loading…
Reference in a new issue