mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-08 14:50:26 +01:00
5551c161ca
We're about to remove automatic retrying of connect, and that uncovered that we actually print out our "Server started" message before we create the listening socket. Move the init higher (outside the db transaction) and make it a request/response, the loop until it's done. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8.2 KiB
8.2 KiB
1 | #include <common/cryptomsg.h> |
---|---|
2 | #include <common/wireaddr.h> |
3 | #include <wire/gen_onion_wire.h> |
4 | # Initialize the gossip daemon. |
5 | gossipctl_init,3000 |
6 | gossipctl_init,,broadcast_interval,u32 |
7 | gossipctl_init,,chain_hash,struct bitcoin_blkid |
8 | gossipctl_init,,id,struct pubkey |
9 | # If non-zero, port to listen on. |
10 | gossipctl_init,,port,u16 |
11 | gossipctl_init,,gflen,u16 |
12 | gossipctl_init,,gfeatures,gflen*u8 |
13 | gossipctl_init,,lflen,u16 |
14 | gossipctl_init,,lfeatures,lflen*u8 |
15 | gossipctl_init,,num_wireaddrs,u16 |
16 | gossipctl_init,,wireaddrs,num_wireaddrs*struct wireaddr |
17 | gossipctl_init,,rgb,3*u8 |
18 | gossipctl_init,,alias,32*u8 |
19 | gossipctl_init,,update_channel_interval,u32 |
20 | # Gossipd->master, I am ready. |
21 | gossipctl_init_reply,3100 |
22 | # Master -> gossipd: Optional hint for where to find peer. |
23 | gossipctl_peer_addrhint,3014 |
24 | gossipctl_peer_addrhint,,id,struct pubkey |
25 | gossipctl_peer_addrhint,,addr,struct wireaddr |
26 | # Master -> gossipd: connect to a peer. We may get a peer_connected or |
27 | # peer_already_connected |
28 | gossipctl_reach_peer,3001 |
29 | gossipctl_reach_peer,,id,struct pubkey |
30 | # Gossipd -> master: we got a peer. Two fds: peer and gossip |
31 | gossip_peer_connected,3002 |
32 | gossip_peer_connected,,id,struct pubkey |
33 | gossip_peer_connected,,addr,struct wireaddr |
34 | gossip_peer_connected,,crypto_state,struct crypto_state |
35 | gossip_peer_connected,,gossip_index,u64 |
36 | gossip_peer_connected,,gflen,u16 |
37 | gossip_peer_connected,,gfeatures,gflen*u8 |
38 | gossip_peer_connected,,lflen,u16 |
39 | gossip_peer_connected,,lfeatures,lflen*u8 |
40 | # Gossipd -> master: you asked to reach a peer, we already had. |
41 | gossip_peer_already_connected,3015 |
42 | gossip_peer_already_connected,,id,struct pubkey |
43 | # gossipd -> master: attempted to connect, unsuccessful, gave up |
44 | gossip_peer_connection_failed,3020 |
45 | gossip_peer_connection_failed,,id,struct pubkey |
46 | gossip_peer_connection_failed,,timeout,u32 |
47 | gossip_peer_connection_failed,,attempts,u32 |
48 | gossip_peer_connection_failed,,addr_unknown,bool |
49 | # Gossipd -> master: peer sent non-gossip packet. Two fds: peer and gossip |
50 | gossip_peer_nongossip,3003 |
51 | gossip_peer_nongossip,,id,struct pubkey |
52 | gossip_peer_nongossip,,addr,struct wireaddr |
53 | gossip_peer_nongossip,,crypto_state,struct crypto_state |
54 | gossip_peer_nongossip,,gossip_index,u64 |
55 | gossip_peer_nongossip,,gflen,u16 |
56 | gossip_peer_nongossip,,gfeatures,gflen*u8 |
57 | gossip_peer_nongossip,,lflen,u16 |
58 | gossip_peer_nongossip,,lfeatures,lflen*u8 |
59 | gossip_peer_nongossip,,len,u16 |
60 | gossip_peer_nongossip,,msg,len*u8 |
61 | # Master -> gossipd: release a peer (so we can open a channel) |
62 | gossipctl_release_peer,3004 |
63 | gossipctl_release_peer,,id,struct pubkey |
64 | # Gossipd -> master: reply to gossip_release_peer. Two fds: peer and gossip. |
65 | gossipctl_release_peer_reply,3104 |
66 | gossipctl_release_peer_reply,,addr,struct wireaddr |
67 | gossipctl_release_peer_reply,,crypto_state,struct crypto_state |
68 | gossipctl_release_peer_reply,,gossip_index,u64 |
69 | gossipctl_release_peer_reply,,gflen,u16 |
70 | gossipctl_release_peer_reply,,gfeatures,gflen*u8 |
71 | gossipctl_release_peer_reply,,lflen,u16 |
72 | gossipctl_release_peer_reply,,lfeatures,lflen*u8 |
73 | # Gossipd -> master: reply to gossip_release_peer if we couldn't find the peer. |
74 | gossipctl_release_peer_replyfail,3204 |
75 | # master -> gossipd: take back peer, with optional msg. (+peer fd, +gossip fd) |
76 | gossipctl_hand_back_peer,3013 |
77 | gossipctl_hand_back_peer,,id,struct pubkey |
78 | gossipctl_hand_back_peer,,crypto_state,struct crypto_state |
79 | gossipctl_hand_back_peer,,gossip_index,u64 |
80 | gossipctl_hand_back_peer,,len,u16 |
81 | gossipctl_hand_back_peer,,msg,len*u8 |
82 | # Pass JSON-RPC getnodes call through |
83 | gossip_getnodes_request,3005 |
84 | # Can be 0 or 1 currently |
85 | gossip_getnodes_request,,num,u16 |
86 | gossip_getnodes_request,,id,num*struct pubkey |
87 | #include <lightningd/gossip_msg.h> |
88 | gossip_getnodes_reply,3105 |
89 | gossip_getnodes_reply,,num_nodes,u16 |
90 | gossip_getnodes_reply,,nodes,num_nodes*struct gossip_getnodes_entry |
91 | # Pass JSON-RPC getroute call through |
92 | gossip_getroute_request,3006 |
93 | gossip_getroute_request,,source,struct pubkey |
94 | gossip_getroute_request,,destination,struct pubkey |
95 | gossip_getroute_request,,msatoshi,u64 |
96 | gossip_getroute_request,,riskfactor,u16 |
97 | gossip_getroute_request,,final_cltv,u32 |
98 | gossip_getroute_request,,fuzz,double |
99 | gossip_getroute_request,,seed,struct siphash_seed |
100 | gossip_getroute_reply,3106 |
101 | gossip_getroute_reply,,num_hops,u16 |
102 | gossip_getroute_reply,,hops,num_hops*struct route_hop |
103 | gossip_getchannels_request,3007 |
104 | # In practice, 0 or 1. |
105 | gossip_getchannels_request,,num,u16 |
106 | gossip_getchannels_request,,short_channel_id,num*struct short_channel_id |
107 | gossip_getchannels_reply,3107 |
108 | gossip_getchannels_reply,,num_channels,u16 |
109 | gossip_getchannels_reply,,nodes,num_channels*struct gossip_getchannels_entry |
110 | # Ping/pong test. Waits for a reply if it expects one. |
111 | gossip_ping,3008 |
112 | gossip_ping,,id,struct pubkey |
113 | gossip_ping,,num_pong_bytes,u16 |
114 | gossip_ping,,len,u16 |
115 | gossip_ping_reply,3108 |
116 | # False if id in gossip_ping was unknown. |
117 | gossip_ping_reply,,sent,bool |
118 | # 0 == no pong expected |
119 | gossip_ping_reply,,totlen,u16 |
120 | # Given a short_channel_id, return the endpoints |
121 | gossip_resolve_channel_request,3009 |
122 | gossip_resolve_channel_request,,channel_id,struct short_channel_id |
123 | gossip_resolve_channel_reply,3109 |
124 | gossip_resolve_channel_reply,,num_keys,u16 |
125 | gossip_resolve_channel_reply,,keys,num_keys*struct pubkey |
126 | # The main daemon asks for peers |
127 | gossip_getpeers_request,3011 |
128 | # 0 or 1 |
129 | gossip_getpeers_request,,num,u16 |
130 | gossip_getpeers_request,,id,num*struct pubkey |
131 | gossip_getpeers_reply,3111 |
132 | gossip_getpeers_reply,,num,u16 |
133 | gossip_getpeers_reply,,id,num*struct pubkey |
134 | gossip_getpeers_reply,,addr,num*struct wireaddr |
135 | gossip_getpeers_reply,,numnodes,u16 |
136 | gossip_getpeers_reply,,nodes,numnodes*struct gossip_getnodes_entry |
137 | # Channel daemon can ask for updates for a specific channel, for sending |
138 | # errors. Must be distinct from WIRE_CHANNEL_ANNOUNCEMENT etc. gossip msgs! |
139 | gossip_get_update,3012 |
140 | gossip_get_update,,short_channel_id,struct short_channel_id |
141 | # If channel isn't known, update will be empty. |
142 | gossip_get_update_reply,3112 |
143 | gossip_get_update_reply,,len,u16 |
144 | gossip_get_update_reply,,update,len*u8 |
145 | # Gossipd can tell channeld etc about gossip to fwd. |
146 | gossip_send_gossip,3016 |
147 | gossip_send_gossip,,gossip_index,u64 |
148 | gossip_send_gossip,,len,u16 |
149 | gossip_send_gossip,,gossip,len*u8 |
150 | # Both sides have seen the funding tx being locked, but we have not |
151 | # yet reached the announcement depth. So we add the channel locally so |
152 | # we can use it already. |
153 | gossip_local_add_channel,3017 |
154 | gossip_local_add_channel,,short_channel_id,struct short_channel_id |
155 | gossip_local_add_channel,,chain_hash,struct bitcoin_blkid |
156 | gossip_local_add_channel,,remote_node_id,struct pubkey |
157 | gossip_local_add_channel,,cltv_expiry_delta,u16 |
158 | gossip_local_add_channel,,htlc_minimum_msat,u64 |
159 | gossip_local_add_channel,,fee_base_msat,u32 |
160 | gossip_local_add_channel,,fee_proportional_millionths,u32 |
161 | # Gossipd->master get this tx output please. |
162 | gossip_get_txout,3018 |
163 | gossip_get_txout,,short_channel_id,struct short_channel_id |
164 | # master->gossipd here is the output, or empty if none. |
165 | gossip_get_txout_reply,3118 |
166 | gossip_get_txout_reply,,short_channel_id,struct short_channel_id |
167 | gossip_get_txout_reply,,satoshis,u64 |
168 | gossip_get_txout_reply,,len,u16 |
169 | gossip_get_txout_reply,,outscript,len*u8 |
170 | # client->gossipd: Disable the channel matching the short_channel_id |
171 | gossip_disable_channel,3019 |
172 | gossip_disable_channel,,short_channel_id,struct short_channel_id |
173 | gossip_disable_channel,,direction,u8 |
174 | gossip_disable_channel,,active,bool |
175 | # master->gossipd a routing failure occurred |
176 | gossip_routing_failure,3021 |
177 | gossip_routing_failure,,erring_node,struct pubkey |
178 | gossip_routing_failure,,erring_channel,struct short_channel_id |
179 | gossip_routing_failure,,failcode,u16 |
180 | gossip_routing_failure,,len,u16 |
181 | gossip_routing_failure,,channel_update,len*u8 |
182 | # master->gossipd temporarily mark a channel unroutable |
183 | # (used in case of unparseable onion reply) |
184 | gossip_mark_channel_unroutable,3022 |
185 | gossip_mark_channel_unroutable,,channel,struct short_channel_id |
186 | # master->gossipd: Request to disconnect from a peer. |
187 | gossipctl_peer_disconnect,3023 |
188 | gossipctl_peer_disconnect,,id,struct pubkey |
189 | # Gossipd -> master: reply to gossip_peer_disconnect with peer id. |
190 | gossipctl_peer_disconnect_reply,3123 |
191 | # Gossipd -> master: reply to gossip_peer_disconnect if we couldn't find the peer. |
192 | gossipctl_peer_disconnect_replyfail,3223 |
193 | gossipctl_peer_disconnect_replyfail,,isconnected,bool |
194 | # master -> gossipd: a potential funding outpoint was spent, please forget the eventual channel |
195 | gossip_outpoint_spent,3024 |
196 | gossip_outpoint_spent,,short_channel_id,struct short_channel_id |