mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
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:
parent
e4cd2148ab
commit
2b0aba13a8
@ -633,6 +633,13 @@ static void connect_failed(struct daemon *daemon,
|
|||||||
status_peer_debug(id, "Failed connected out: %s", errmsg);
|
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
|
/*~ This is the destructor for the (unsuccessful) connection. We accumulate
|
||||||
* the errors which occurred, so we can report to lightningd properly in case
|
* the errors which occurred, so we can report to lightningd properly in case
|
||||||
* they all fail, and try the next address.
|
* 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"))
|
if (streq(connect->connstate, "Cryptographic handshake"))
|
||||||
errstr = "peer closed connection (wrong key?)";
|
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,
|
type_to_string(tmpctx, struct wireaddr_internal,
|
||||||
&connect->addrs[connect->addrnum]),
|
&connect->addrs[connect->addrnum]),
|
||||||
connect->connstate, errstr);
|
connect->connstate, errstr));
|
||||||
connect->addrnum++;
|
connect->addrnum++;
|
||||||
try_connect_one_addr(connect);
|
try_connect_one_addr(connect);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,9 @@ struct wireaddr_internal;
|
|||||||
/* Called by io_tor_connect once it has a connection out. */
|
/* Called by io_tor_connect once it has a connection out. */
|
||||||
struct io_plan *connection_out(struct io_conn *conn, struct connecting *connect);
|
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. */
|
/* Called by peer_exchange_initmsg if successful. */
|
||||||
struct io_plan *peer_connected(struct io_conn *conn,
|
struct io_plan *peer_connected(struct io_conn *conn,
|
||||||
struct daemon *daemon,
|
struct daemon *daemon,
|
||||||
|
Loading…
Reference in New Issue
Block a user