Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.82k stars 2.03k forks source link

[Bug] Bad error message when manually adding a peer that fails to connect #14094

Closed emlowe closed 1 year ago

emlowe commented 1 year ago

What happened?

when added manually a peer , if we can't connect, the backend code throws a very generic and unhelpful exception:

2022-12-08T15:18:08.115 full_node full_node_server        : INFO     Cannot connect to host 10.1.1.23:3435 ssl:<ssl.SSLContext object at 0x0000018289A90F40> [The semaphore timeout period has expired]
2022-12-08T15:18:08.116 full_node chia.rpc.util           : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia\rpc\util.py", line 18, in inner
  File "chia\rpc\rpc_server.py", line 273, in open_connection
ValueError: Start client failed, or server is not set

The CLI handles this exception though, and just returns "Failed to connect":

→ C:\Users\elowe\AppData\Local\Programs\Chia\resources\app.asar.unpacked\daemon› chia peer -a 10.1.1.23:3435 full_node
Connecting to 10.1.1.23, 3435
Failed to connect to 10.1.1.23:3435

The GUI however, takes the ValueError text of Start client filed, or server is not set and displays it to the end-user. Which is of course, entirely unhelpful.

I think probably several fixes are needed here. Both in the back end and in the GUI

Version

1.7.0

What platform are you using?

Windows

What ui mode are you using?

GUI

Relevant log output

2022-12-08T15:18:08.115 full_node full_node_server        : INFO     Cannot connect to host 10.1.1.23:3435 ssl:<ssl.SSLContext object at 0x0000018289A90F40> [The semaphore timeout period has expired]
2022-12-08T15:18:08.116 full_node chia.rpc.util           : WARNING  Error while handling message: Traceback (most recent call last):
  File "chia\rpc\util.py", line 18, in inner
  File "chia\rpc\rpc_server.py", line 273, in open_connection
ValueError: Start client failed, or server is not set
almogdepaz commented 1 year ago

fix pr at https://github.com/Chia-Network/chia-blockchain/pull/14108/files