Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to connect to a non-existing full node #11184

Closed
BTCparadigm opened this issue Aug 1, 2023 · 8 comments · Fixed by #12949
Closed

Don't try to connect to a non-existing full node #11184

BTCparadigm opened this issue Aug 1, 2023 · 8 comments · Fixed by #12949
Assignees
Milestone

Comments

@BTCparadigm
Copy link
Collaborator

General Description

My logs are sometimes full of lines about trying to connect to a node, even though I don't have one in my local network, and I haven't touched the settings. Not sure if it's a problem, but it looked weird.

How To Reproduce?

I don't know.

Screenshots

DontQueryNode

Operating System

Win10

Logs

See Screenshots

Wasabi Version

Master 4486632

@BTCparadigm BTCparadigm changed the title Don't look for a node unnecessarily Don't try to connect to a non-existing full node Aug 1, 2023
@nopara73
Copy link
Contributor

nopara73 commented Aug 2, 2023

Wasabi connects to the local full node by default. That's a feature, not a bug. However, the warnings should not be happening.

@molnard
Copy link
Collaborator

molnard commented Aug 10, 2023

Yes, the warning message should be DEBUG level - but only in case of the intention was not to use full node otherwise it should be a warning.

@turbolay
Copy link
Collaborator

Can anyone repro this? I didn't see this issue happening on my side for a long time.

@Szpoti
Copy link
Collaborator

Szpoti commented Oct 24, 2023

Haven't been able to reproduce since.

@molnard
Copy link
Collaborator

molnard commented Dec 21, 2023

Can you still repro this Rafe?

@BTCparadigm
Copy link
Collaborator Author

@molnard yes, I saw this again few days ago while running master.

@MarnixCroes
Copy link
Collaborator

can repro, 2.0.6 RC1 02a6ee2

[32] WARNING	SpecificNodeBlockProvider.ReconnectingLoopAsync (119)	Wasabi could not complete the handshake with the node '127.0.0.1:8333'. Probably Wasabi is not whitelisted by the node.
Use "whitebind" in the node configuration. Typically whitebind=127.0.0.1:8333 if Wasabi and the node are on the same machine and whitelist=1.2.3.4 if they are not.
2024-02-23 11:21:00.028 [57] WARNING	PeriodicRunner.ExecuteAsync (110)	System.Net.Http.HttpRequestException: Failed to handle the HTTP request via Tor.
 ---> WalletWasabi.Tor.Socks5.Exceptions.TorConnectionException: Failed to read/write HTTP(s) request.
 ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
   at System.Net.Security.SslStream.ReceiveHandshakeFrameAsync[TIOAdapter](CancellationToken cancellationToken)
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Socks5.TorTcpConnectionFactory.UpgradeToSslAsync(TcpClient tcpClient, String host, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Socks5.TorTcpConnectionFactory.ConnectAsync(String host, Int32 port, Boolean useSsl, INamedCircuit circuit, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Socks5.TorTcpConnectionFactory.ConnectAsync(Uri requestUri, INamedCircuit circuit, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Socks5.Pool.TorHttpPool.CreateNewConnectionAsync(Uri requestUri, INamedCircuit circuit, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Socks5.Pool.TorHttpPool.ObtainFreeConnectionAsync(Uri requestUri, ICircuit circuit, CancellationToken token)
   at WalletWasabi.Tor.Socks5.Pool.TorHttpPool.SendAsync(HttpRequestMessage request, ICircuit circuit, Int32 maximumRedirects, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at WalletWasabi.Tor.Socks5.Pool.TorHttpPool.SendAsync(HttpRequestMessage request, ICircuit circuit, Int32 maximumRedirects, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Http.TorHttpClient.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at WalletWasabi.Tor.Http.TorHttpClient.SendAsync(HttpMethod method, String relativeUri, HttpContent content, CancellationToken cancellationToken)
   at WalletWasabi.WebClients.Wasabi.WasabiClient.GetVersionsAsync(CancellationToken cancel)
   at WalletWasabi.WebClients.Wasabi.WasabiClient.CheckUpdatesAsync(CancellationToken cancel)
   at WalletWasabi.Services.UpdateChecker.ActionAsync(CancellationToken cancel)
   at WalletWasabi.Bases.PeriodicRunner.ExecuteAsync(CancellationToken stoppingToken)

@molnard molnard added this to the v2.0.7 milestone Feb 24, 2024
@molnard molnard assigned molnard and unassigned molnard Mar 13, 2024
@turbolay
Copy link
Collaborator

turbolay commented Apr 2, 2024

This should not be debug level, and it should not be hidden either. It's definitely a problem.
It means that there is a local node, we managed to connect to it, but not to handshake.
So we are not connected to the node.

So the problem is to log several times in a row I suppose. What we can do is to add a bool so we only log once, that way:

diff --git a/WalletWasabi/Wallets/SpecificNodeBlockProvider.cs b/WalletWasabi/Wallets/SpecificNodeBlockProvider.cs
index 7ebaa1c78..85f99f844 100644
--- a/WalletWasabi/Wallets/SpecificNodeBlockProvider.cs
+++ b/WalletWasabi/Wallets/SpecificNodeBlockProvider.cs
@@ -86,6 +86,8 @@ public class SpecificNodeBlockProvider : IBlockProvider, IAsyncDisposable
                CancellationToken shutdownToken = LoopCts.Token;
                TimeSpan reconnectDelay = MinReconnectDelay;
 
+               var shouldLogHandShakeWarning = true;
+
                while (!shutdownToken.IsCancellationRequested)
                {
                        using CancellationTokenSource connectCts = new(TimeSpan.FromSeconds(10));
@@ -97,6 +99,8 @@ public class SpecificNodeBlockProvider : IBlockProvider, IAsyncDisposable
                        {
                                using ConnectedNode connectedNode = await ConnectAsync(linkedCts.Token).ConfigureAwait(false);
 
+                               shouldLogHandShakeWarning = true;
+
                                // Reset reconnect delay as we actually connected the local node.
                                reconnectDelay = MinReconnectDelay;
                                _specificBitcoinCoreNode = connectedNode;
@@ -117,7 +121,11 @@ public class SpecificNodeBlockProvider : IBlockProvider, IAsyncDisposable
                                                Use "whitebind" in the node configuration. Typically whitebind=127.0.0.1:8333 if Wasabi and the node are on the same machine and whitelist=1.2.3.4 if they are not.
                                                """;
 
-                                       Logger.LogWarning(message);
+                                       if (shouldLogHandShakeWarning)
+                                       {
+                                               Logger.LogWarning(message);
+                                               shouldLogHandShakeWarning = false;
+                                       }
                                }
 
                                if (!shutdownToken.IsCancellationRequested)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants