mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
2424b7dea8
Either because lightningd tells us it wants to talk, or because the peer says something about a channel. We also introduce a behavior change: we disconnect after a failed open. We might want to modify this later, but we it's a side-effect of openingd not holding onto idle connections. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
5.9 KiB
5.9 KiB
1 | #include <bitcoin/block.h> |
---|---|
2 | #include <common/channel_id.h> |
3 | #include <common/cryptomsg.h> |
4 | #include <common/features.h> |
5 | #include <common/node_id.h> |
6 | #include <common/wireaddr.h> |
7 | #include <wire/onion_wire.h> |
8 | msgtype,connectd_init,2000 |
9 | msgdata,connectd_init,chainparams,chainparams, |
10 | msgdata,connectd_init,our_features,feature_set, |
11 | msgdata,connectd_init,id,node_id, |
12 | msgdata,connectd_init,num_wireaddrs,u16, |
13 | msgdata,connectd_init,wireaddrs,wireaddr_internal,num_wireaddrs |
14 | msgdata,connectd_init,listen_announce,enum addr_listen_announce,num_wireaddrs |
15 | msgdata,connectd_init,tor_proxyaddr,?wireaddr, |
16 | msgdata,connectd_init,use_tor_proxy_always,bool, |
17 | msgdata,connectd_init,dev_allow_localhost,bool, |
18 | msgdata,connectd_init,use_dns,bool, |
19 | msgdata,connectd_init,tor_password,wirestring, |
20 | msgdata,connectd_init,use_v3_autotor,bool, |
21 | msgdata,connectd_init,timeout_secs,u32, |
22 | msgdata,connectd_init,websocket_helper,wirestring, |
23 | msgdata,connectd_init,websocket_port,u16, |
24 | msgdata,connectd_init,dev_fast_gossip,bool, |
25 | # If this is set, then fd 5 is dev_disconnect_fd. |
26 | msgdata,connectd_init,dev_disconnect,bool, |
27 | # Connectd->master, here are the addresses I bound, can announce. |
28 | msgtype,connectd_init_reply,2100 |
29 | msgdata,connectd_init_reply,num_bindings,u16, |
30 | msgdata,connectd_init_reply,bindings,wireaddr_internal,num_bindings |
31 | msgdata,connectd_init_reply,num_announceable,u16, |
32 | msgdata,connectd_init_reply,announceable,wireaddr,num_announceable |
33 | msgdata,connectd_init_reply,failmsg,?wirestring, |
34 | # Activate the connect daemon, so others can connect. |
35 | msgtype,connectd_activate,2025 |
36 | # Do we listen? |
37 | msgdata,connectd_activate,listen,bool, |
38 | # Connectd->master, I am ready. |
39 | msgtype,connectd_activate_reply,2125 |
40 | msgdata,connectd_activate_reply,failmsg,?wirestring, |
41 | # connectd->master: disconnect this peer please (due to reconnect). |
42 | msgtype,connectd_reconnected,2112 |
43 | msgdata,connectd_reconnected,id,node_id, |
44 | # Master -> connectd: connect to a peer. |
45 | msgtype,connectd_connect_to_peer,2001 |
46 | msgdata,connectd_connect_to_peer,id,node_id, |
47 | msgdata,connectd_connect_to_peer,seconds_waited,u32, |
48 | msgdata,connectd_connect_to_peer,len,u32, |
49 | msgdata,connectd_connect_to_peer,addrs,wireaddr,len |
50 | msgdata,connectd_connect_to_peer,addrhint,?wireaddr_internal, |
51 | # Connectd->master: connect failed. |
52 | msgtype,connectd_connect_failed,2020 |
53 | msgdata,connectd_connect_failed,id,node_id, |
54 | msgdata,connectd_connect_failed,failcode,errcode_t, |
55 | msgdata,connectd_connect_failed,failreason,wirestring, |
56 | msgdata,connectd_connect_failed,seconds_to_delay,u32, |
57 | msgdata,connectd_connect_failed,addrhint,?wireaddr_internal, |
58 | # Connectd -> master: we got a peer. |
59 | msgtype,connectd_peer_connected,2002 |
60 | msgdata,connectd_peer_connected,id,node_id, |
61 | msgdata,connectd_peer_connected,addr,wireaddr_internal, |
62 | msgdata,connectd_peer_connected,remote_addr,?wireaddr, |
63 | msgdata,connectd_peer_connected,incoming,bool, |
64 | msgdata,connectd_peer_connected,flen,u16, |
65 | msgdata,connectd_peer_connected,features,u8,flen |
66 | # connectd -> master: peer disconnected. |
67 | msgtype,connectd_peer_disconnect_done,2006 |
68 | msgdata,connectd_peer_disconnect_done,id,node_id, |
69 | # Master -> connectd: make peer active immediately (we want to talk) |
70 | msgtype,connectd_peer_make_active,2004 |
71 | msgdata,connectd_peer_make_active,id,node_id, |
72 | msgdata,connectd_peer_make_active,channel_id,?channel_id, |
73 | # Connectd -> master: peer said something interesting (or you said make_active) |
74 | # Plus fd for peer daemon. |
75 | msgtype,connectd_peer_active,2005 |
76 | msgdata,connectd_peer_active,id,node_id, |
77 | msgdata,connectd_peer_active,msgtype,?u16, |
78 | msgdata,connectd_peer_active,channel_id,?channel_id, |
79 | # master -> connectd: peer no longer wanted, you can disconnect. |
80 | msgtype,connectd_discard_peer,2015 |
81 | msgdata,connectd_discard_peer,id,node_id, |
82 | # master -> connectd: give message to peer and disconnect. |
83 | msgtype,connectd_peer_final_msg,2003 |
84 | msgdata,connectd_peer_final_msg,id,node_id, |
85 | msgdata,connectd_peer_final_msg,len,u16, |
86 | msgdata,connectd_peer_final_msg,msg,u8,len |
87 | # connectd->master: You said to connect, but we already were. |
88 | msgtype,connectd_peer_already_connected,2007 |
89 | msgdata,connectd_peer_already_connected,id,node_id, |
90 | # master -> connectd: do you have a memleak? |
91 | msgtype,connectd_dev_memleak,2033 |
92 | msgtype,connectd_dev_memleak_reply,2133 |
93 | msgdata,connectd_dev_memleak_reply,leak,bool, |
94 | # Ping/pong test. Waits for a reply if it expects one. |
95 | msgtype,connectd_ping,2030 |
96 | msgdata,connectd_ping,id,node_id, |
97 | msgdata,connectd_ping,num_pong_bytes,u16, |
98 | msgdata,connectd_ping,len,u16, |
99 | msgtype,connectd_ping_reply,2130 |
100 | # False if we there was already a ping in progress. |
101 | msgdata,connectd_ping_reply,sent,bool, |
102 | # 0 == no pong expected, otherwise length of pong. |
103 | msgdata,connectd_ping_reply,totlen,u16, |
104 | # We tell lightningd we got an onionmsg |
105 | msgtype,connectd_got_onionmsg_to_us,2145 |
106 | msgdata,connectd_got_onionmsg_to_us,obs2,bool, |
107 | msgdata,connectd_got_onionmsg_to_us,node_alias,pubkey, |
108 | msgdata,connectd_got_onionmsg_to_us,self_id,?secret, |
109 | msgdata,connectd_got_onionmsg_to_us,reply_blinding,?pubkey, |
110 | msgdata,connectd_got_onionmsg_to_us,reply_first_node,?pubkey, |
111 | msgdata,connectd_got_onionmsg_to_us,reply_path_len,u16, |
112 | msgdata,connectd_got_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len |
113 | msgdata,connectd_got_onionmsg_to_us,rawmsg_len,u16, |
114 | msgdata,connectd_got_onionmsg_to_us,rawmsg,u8,rawmsg_len |
115 | # Lightningd tells us to send an onion message. |
116 | msgtype,connectd_send_onionmsg,2041 |
117 | msgdata,connectd_send_onionmsg,obs2,bool, |
118 | msgdata,connectd_send_onionmsg,id,node_id, |
119 | msgdata,connectd_send_onionmsg,onion_len,u16, |
120 | msgdata,connectd_send_onionmsg,onion,u8,onion_len |
121 | msgdata,connectd_send_onionmsg,blinding,pubkey, |
122 | # A custom message that we got from a peer and don't know how to handle, so we |
123 | # forward it to the master for further handling. |
124 | msgtype,connectd_custommsg_in,2110 |
125 | msgdata,connectd_custommsg_in,id,node_id, |
126 | msgdata,connectd_custommsg_in,msg_len,u16, |
127 | msgdata,connectd_custommsg_in,msg,u8,msg_len |
128 | # A custom message that the lightningd tells us to send to the peer. |
129 | msgtype,connectd_custommsg_out,2011 |
130 | msgdata,connectd_custommsg_out,id,node_id, |
131 | msgdata,connectd_custommsg_out,msg_len,u16, |
132 | msgdata,connectd_custommsg_out,msg,u8,msg_len |