core-lightning/connectd/connect_wire.csv
Rusty Russell 30f08cc2b0 connectd: always tell master when connection fails/succeeded.
We used to separate implicit connection requests (ie. timed retries
for important peers) and explicit ones, and send a
WIRE_CONNECTCTL_CONNECT_TO_PEER_RESULT for the latter.

In the success case, that's now redundant, since we hand the connected
peer to the master using WIRE_CONNECT_PEER_CONNECTED; we just need a
message for the failure case.  And we might as well tell the master
every failure, so we don't have to distinguish internally.

This also solves a race we had before: connectd would send
WIRE_CONNECTCTL_CONNECT_TO_PEER_RESULT which completes the incoming
JSON connect command, then send WIRE_CONNECT_PEER_CONNECTED.  So
there's a window where the JSON command can return, but the peer isn't
known to lightningd yet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-08-09 19:44:27 +02:00

2.5 KiB

1#include <common/cryptomsg.h>
2#include <common/wireaddr.h>
3#include <lightningd/gossip_msg.h>
4connectctl_init,2000
5connectctl_init,,id,struct pubkey
6connectctl_init,,gflen,u16
7connectctl_init,,gfeatures,gflen*u8
8connectctl_init,,lflen,u16
9connectctl_init,,lfeatures,lflen*u8
10connectctl_init,,num_wireaddrs,u16
11connectctl_init,,wireaddrs,num_wireaddrs*struct wireaddr_internal
12connectctl_init,,listen_announce,num_wireaddrs*enum addr_listen_announce
13connectctl_init,,reconnect,bool
14connectctl_init,,tor_proxyaddr,?struct wireaddr
15connectctl_init,,use_tor_proxy_always,bool
16connectctl_init,,dev_allow_localhost,bool
17connectctl_init,,use_dns,bool
18connectctl_init,,tor_password,wirestring
19# Connectd->master, here are the addresses I bound, can announce.
20connectctl_init_reply,2100
21connectctl_init_reply,,num_bindings,u16
22connectctl_init_reply,,bindings,num_bindings*struct wireaddr_internal
23connectctl_init_reply,,num_announcable,u16
24connectctl_init_reply,,announcable,num_announcable*struct wireaddr
25# Activate the connect daemon, so others can connect.
26connectctl_activate,2025
27# Do we listen?
28connectctl_activate,,listen,bool
29# Connectd->master, I am ready.
30connectctl_activate_reply,2125
31# connectd->master: disconnect this peer please (due to reconnect).
32connect_reconnected,2112
33connect_reconnected,,id,struct pubkey
34# Master -> connectd: Optional hint for where to find peer.
35connectctl_peer_addrhint,2014
36connectctl_peer_addrhint,,id,struct pubkey
37connectctl_peer_addrhint,,addr,struct wireaddr_internal
38# Master -> connectd: connect to a peer.
39connectctl_connect_to_peer,2001
40connectctl_connect_to_peer,,id,struct pubkey
41# Connectd->master: connect failed.
42connectctl_connect_failed,2020
43connectctl_connect_failed,,id,struct pubkey
44connectctl_connect_failed,,failreason,wirestring
45# Master -> connectd: try to always maintain connection to this peer (or not)
46connectctl_peer_important,2010
47connectctl_peer_important,,id,struct pubkey
48connectctl_peer_important,,important,bool
49# Connectd -> master: we got a peer. Two fds: peer and gossip
50connect_peer_connected,2002
51connect_peer_connected,,id,struct pubkey
52connect_peer_connected,,addr,struct wireaddr_internal
53connect_peer_connected,,crypto_state,struct crypto_state
54connect_peer_connected,,gflen,u16
55connect_peer_connected,,gfeatures,gflen*u8
56connect_peer_connected,,lflen,u16
57connect_peer_connected,,lfeatures,lflen*u8
58# master -> connectd: peer has disconnected.
59connectctl_peer_disconnected,2015
60connectctl_peer_disconnected,,id,struct pubkey