connectd/connectd: Display an error hint for V3 tor onions when connect fail.

@thestick613 noticed that since tor version below 0.3.2.2-alpha
will not support V3 ed25519 address formats, the error handling
is not that helpful in the error message from cli.
So now we add an hint.

Changelog-None:

Signed-off-by: Saibato <saibato.naga@pm.me>

connectd/connectd.h; Add helper function to update conn error list

Signed-off-by: Saibato <saibato.naga@pm.me>
This commit is contained in:
Saibato 2020-04-14 16:03:04 +02:00 committed by Christian Decker
parent e4cd2148ab
commit 2b0aba13a8
2 changed files with 14 additions and 3 deletions

View File

@ -633,6 +633,13 @@ static void connect_failed(struct daemon *daemon,
status_peer_debug(id, "Failed connected out: %s", errmsg);
}
/* add errors to error list */
void add_errors_to_error_list(struct connecting *connect, const char *error)
{
tal_append_fmt(&connect->errors,
"%s. ", error);
}
/*~ This is the destructor for the (unsuccessful) connection. We accumulate
* the errors which occurred, so we can report to lightningd properly in case
* they all fail, and try the next address.
@ -650,11 +657,12 @@ static void destroy_io_conn(struct io_conn *conn, struct connecting *connect)
if (streq(connect->connstate, "Cryptographic handshake"))
errstr = "peer closed connection (wrong key?)";
}
tal_append_fmt(&connect->errors,
"%s: %s: %s. ",
add_errors_to_error_list(connect,
tal_fmt(tmpctx, "%s: %s: %s",
type_to_string(tmpctx, struct wireaddr_internal,
&connect->addrs[connect->addrnum]),
connect->connstate, errstr);
connect->connstate, errstr));
connect->addrnum++;
try_connect_one_addr(connect);
}

View File

@ -13,6 +13,9 @@ struct wireaddr_internal;
/* Called by io_tor_connect once it has a connection out. */
struct io_plan *connection_out(struct io_conn *conn, struct connecting *connect);
/* add erros to error list */
void add_errors_to_error_list(struct connecting *connect, const char *error);
/* Called by peer_exchange_initmsg if successful. */
struct io_plan *peer_connected(struct io_conn *conn,
struct daemon *daemon,