mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
monero onion node test patch
might need more work to prevent the changes throughout the stack ... would be good to limit it to 1 or 2 changes instead of 3 also added proxyInfo-contextual timeout
This commit is contained in:
parent
4d1fde7671
commit
615fdfb5bf
3 changed files with 15 additions and 2 deletions
|
@ -108,6 +108,11 @@ Future<MoneroNodeConnectionResponse> testMoneroNodeConnection(
|
|||
await socket.connect();
|
||||
await socket.connectTo(uri.host, uri.port);
|
||||
|
||||
// If this is an onion node and connectTo didn't throw, it's a success.
|
||||
// if (uri.host.endsWith(".onion")) {
|
||||
// return MoneroNodeConnectionResponse(null, null, null, true);
|
||||
// }
|
||||
|
||||
final body = utf8.encode(
|
||||
jsonEncode({
|
||||
"jsonrpc": "2.0",
|
||||
|
|
|
@ -40,12 +40,17 @@ Future<bool> _xmrHelper(
|
|||
final String path = uri.path.isEmpty ? "/json_rpc" : uri.path;
|
||||
|
||||
final uriString = "${uri.scheme}://${uri.host}:${port ?? 0}$path";
|
||||
final uriString = uri.host.endsWith(".onion")
|
||||
? "${uri.toString()}:$port$path"
|
||||
: uri.hasScheme
|
||||
? uri.toString()
|
||||
: "${data.useSSL! ? "https" : "http"}://$url:$port$path";
|
||||
|
||||
final response = await testMoneroNodeConnection(
|
||||
Uri.parse(uriString),
|
||||
false,
|
||||
proxyInfo: proxyInfo,
|
||||
);
|
||||
).timeout(Duration(seconds: proxyInfo != null ? 30 : 10));
|
||||
|
||||
if (response.cert != null) {
|
||||
if (context.mounted) {
|
||||
|
|
|
@ -202,7 +202,10 @@ class MoneroWallet extends CryptonoteWallet with CwBasedInterface {
|
|||
Future<void> updateNode() async {
|
||||
final node = getCurrentNode();
|
||||
|
||||
final host = Uri.parse(node.host).host;
|
||||
String host = Uri.parse(node.host).host;
|
||||
if (host.isEmpty) {
|
||||
host = node.host;
|
||||
}
|
||||
({InternetAddress host, int port})? proxy;
|
||||
if (prefs.useTor) {
|
||||
proxy = TorService.sharedInstance.getProxyInfo();
|
||||
|
|
Loading…
Reference in a new issue