2017-08-28 18:05:01 +02:00
|
|
|
#include <common/cryptomsg.h>
|
2020-03-31 00:39:00 +02:00
|
|
|
#include <common/features.h>
|
2017-10-23 06:17:38 +02:00
|
|
|
#include <common/wireaddr.h>
|
2018-01-18 00:32:36 +01:00
|
|
|
#include <wire/gen_onion_wire.h>
|
2017-03-10 11:50:43 +01:00
|
|
|
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
# Initialize the gossip daemon.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossipctl_init,3000
|
2019-09-25 22:38:45 +02:00
|
|
|
msgdata,gossipctl_init,chainparams,chainparams,
|
2020-04-03 02:03:59 +02:00
|
|
|
msgdata,gossipctl_init,our_features,feature_set,
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossipctl_init,id,node_id,
|
|
|
|
msgdata,gossipctl_init,rgb,u8,3
|
|
|
|
msgdata,gossipctl_init,alias,u8,32
|
|
|
|
msgdata,gossipctl_init,num_announcable,u16,
|
|
|
|
msgdata,gossipctl_init,announcable,wireaddr,num_announcable
|
|
|
|
msgdata,gossipctl_init,dev_gossip_time,?u32,
|
2019-09-18 03:05:05 +02:00
|
|
|
msgdata,gossipctl_init,dev_fast_gossip,bool,
|
2019-09-26 04:00:20 +02:00
|
|
|
msgdata,gossipctl_init,dev_fast_gossip_prune,bool,
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
|
2019-09-12 02:24:00 +02:00
|
|
|
# In developer mode, we can mess with time.
|
|
|
|
msgtype,gossip_dev_set_time,3001
|
|
|
|
msgdata,gossip_dev_set_time,dev_gossip_time,u32,
|
|
|
|
|
2017-03-12 13:39:23 +01:00
|
|
|
# Pass JSON-RPC getnodes call through
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_getnodes_request,3005
|
|
|
|
msgdata,gossip_getnodes_request,id,?node_id,
|
2017-03-12 13:39:23 +01:00
|
|
|
|
2017-03-16 05:05:26 +01:00
|
|
|
#include <lightningd/gossip_msg.h>
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_getnodes_reply,3105
|
|
|
|
msgdata,gossip_getnodes_reply,num_nodes,u32,
|
|
|
|
msgdata,gossip_getnodes_reply,nodes,gossip_getnodes_entry,num_nodes
|
2017-03-15 11:36:52 +01:00
|
|
|
|
|
|
|
# Pass JSON-RPC getroute call through
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_getroute_request,3006
|
2019-05-31 09:30:33 +02:00
|
|
|
# Source defaults to "us", and means we don't consider first-hop channel fees
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossip_getroute_request,source,?node_id,
|
|
|
|
msgdata,gossip_getroute_request,destination,node_id,
|
|
|
|
msgdata,gossip_getroute_request,msatoshi,amount_msat,
|
2020-01-29 12:30:00 +01:00
|
|
|
msgdata,gossip_getroute_request,riskfactor_millionths,u64,
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossip_getroute_request,final_cltv,u32,
|
2020-01-29 12:30:00 +01:00
|
|
|
msgdata,gossip_getroute_request,fuzz_millionths,u64,
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossip_getroute_request,num_excluded,u16,
|
2019-08-31 15:57:08 +02:00
|
|
|
msgdata,gossip_getroute_request,excluded,exclude_entry,num_excluded
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossip_getroute_request,max_hops,u32,
|
|
|
|
|
|
|
|
msgtype,gossip_getroute_reply,3106
|
|
|
|
msgdata,gossip_getroute_reply,num_hops,u16,
|
|
|
|
msgdata,gossip_getroute_reply,hops,route_hop,num_hops
|
|
|
|
|
|
|
|
msgtype,gossip_getchannels_request,3007
|
|
|
|
msgdata,gossip_getchannels_request,short_channel_id,?short_channel_id,
|
|
|
|
msgdata,gossip_getchannels_request,source,?node_id,
|
|
|
|
msgdata,gossip_getchannels_request,prev,?short_channel_id,
|
|
|
|
|
|
|
|
msgtype,gossip_getchannels_reply,3107
|
|
|
|
msgdata,gossip_getchannels_reply,complete,bool,
|
|
|
|
msgdata,gossip_getchannels_reply,num_channels,u32,
|
|
|
|
msgdata,gossip_getchannels_reply,nodes,gossip_getchannels_entry,num_channels
|
2017-04-12 20:20:48 +02:00
|
|
|
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
# Ping/pong test. Waits for a reply if it expects one.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_ping,3008
|
|
|
|
msgdata,gossip_ping,id,node_id,
|
|
|
|
msgdata,gossip_ping,num_pong_bytes,u16,
|
|
|
|
msgdata,gossip_ping,len,u16,
|
2017-04-12 20:20:48 +02:00
|
|
|
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_ping_reply,3108
|
|
|
|
msgdata,gossip_ping_reply,id,node_id,
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
# False if id in gossip_ping was unknown.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossip_ping_reply,sent,bool,
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
# 0 == no pong expected
|
2019-07-24 00:51:11 +02:00
|
|
|
msgdata,gossip_ping_reply,totlen,u16,
|
2017-04-12 20:20:48 +02:00
|
|
|
|
2018-06-04 06:28:02 +02:00
|
|
|
# Set artificial maximum reply_channel_range size. Master->gossipd
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_dev_set_max_scids_encode_size,3030
|
|
|
|
msgdata,gossip_dev_set_max_scids_encode_size,max,u32,
|
2018-06-04 06:28:02 +02:00
|
|
|
|
2020-02-27 04:47:16 +01:00
|
|
|
# Given a short_channel_id, return the latest (stripped) update for error msg.
|
|
|
|
msgtype,gossip_get_stripped_cupdate,3010
|
|
|
|
msgdata,gossip_get_stripped_cupdate,channel_id,short_channel_id,
|
|
|
|
|
|
|
|
msgtype,gossip_get_stripped_cupdate_reply,3110
|
|
|
|
msgdata,gossip_get_stripped_cupdate_reply,stripped_update_len,u16,
|
|
|
|
msgdata,gossip_get_stripped_cupdate_reply,stripped_update,u8,stripped_update_len
|
|
|
|
|
2018-11-13 05:03:51 +01:00
|
|
|
# gossipd->master: we're closing this channel.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_local_channel_close,3027
|
|
|
|
msgdata,gossip_local_channel_close,short_channel_id,short_channel_id,
|
2018-05-26 15:19:24 +02:00
|
|
|
|
2018-01-04 12:40:58 +01:00
|
|
|
# Gossipd->master get this tx output please.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_get_txout,3018
|
|
|
|
msgdata,gossip_get_txout,short_channel_id,short_channel_id,
|
2018-01-04 12:40:58 +01:00
|
|
|
|
|
|
|
# master->gossipd here is the output, or empty if none.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_get_txout_reply,3118
|
|
|
|
msgdata,gossip_get_txout_reply,short_channel_id,short_channel_id,
|
|
|
|
msgdata,gossip_get_txout_reply,satoshis,amount_sat,
|
|
|
|
msgdata,gossip_get_txout_reply,len,u16,
|
|
|
|
msgdata,gossip_get_txout_reply,outscript,u8,len
|
2018-01-04 12:40:58 +01:00
|
|
|
|
2019-01-17 16:24:32 +01:00
|
|
|
# master->gossipd an htlc failed with this onion error.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_payment_failure,3021
|
|
|
|
msgdata,gossip_payment_failure,erring_node,node_id,
|
|
|
|
msgdata,gossip_payment_failure,erring_channel,short_channel_id,
|
|
|
|
msgdata,gossip_payment_failure,erring_channel_direction,u8,
|
|
|
|
msgdata,gossip_payment_failure,len,u16,
|
|
|
|
msgdata,gossip_payment_failure,error,u8,len
|
2018-02-06 16:32:06 +01:00
|
|
|
|
2018-03-26 20:10:03 +02:00
|
|
|
# master -> gossipd: a potential funding outpoint was spent, please forget the eventual channel
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_outpoint_spent,3024
|
|
|
|
msgdata,gossip_outpoint_spent,short_channel_id,short_channel_id,
|
2018-07-26 23:27:37 +02:00
|
|
|
|
|
|
|
# master -> gossipd: stop gossip timers.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_dev_suppress,3032
|
2018-09-27 07:29:17 +02:00
|
|
|
|
2018-11-21 23:41:49 +01:00
|
|
|
# master -> gossipd: do you have a memleak?
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_dev_memleak,3033
|
2018-11-21 23:41:49 +01:00
|
|
|
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_dev_memleak_reply,3133
|
|
|
|
msgdata,gossip_dev_memleak_reply,leak,bool,
|
2018-11-21 23:41:49 +01:00
|
|
|
|
2019-04-08 01:52:19 +02:00
|
|
|
# master -> gossipd: please rewrite the gossip_store
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_dev_compact_store,3034
|
2019-04-08 01:52:19 +02:00
|
|
|
|
|
|
|
# gossipd -> master: ok
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_dev_compact_store_reply,3134
|
|
|
|
msgdata,gossip_dev_compact_store_reply,success,bool,
|
2019-04-08 01:52:19 +02:00
|
|
|
|
2018-09-27 07:29:17 +02:00
|
|
|
#include <common/bolt11.h>
|
|
|
|
|
|
|
|
# master -> gossipd: get route_info for our incoming channels
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_get_incoming_channels,3025
|
2018-09-27 07:29:17 +02:00
|
|
|
|
|
|
|
# gossipd -> master: here they are.
|
2019-07-24 00:51:11 +02:00
|
|
|
msgtype,gossip_get_incoming_channels_reply,3125
|
2019-12-17 07:11:08 +01:00
|
|
|
msgdata,gossip_get_incoming_channels_reply,num_public,u16,
|
|
|
|
msgdata,gossip_get_incoming_channels_reply,public_route_info,route_info,num_public
|
|
|
|
msgdata,gossip_get_incoming_channels_reply,public_deadends,bool,num_public
|
|
|
|
msgdata,gossip_get_incoming_channels_reply,num_private,u16,
|
|
|
|
msgdata,gossip_get_incoming_channels_reply,private_route_info,route_info,num_private
|
|
|
|
msgdata,gossip_get_incoming_channels_reply,private_deadends,bool,num_private
|
2019-09-22 04:06:43 +02:00
|
|
|
|
|
|
|
# master -> gossipd: blockheight increased.
|
|
|
|
msgtype,gossip_new_blockheight,3026
|
|
|
|
msgdata,gossip_new_blockheight,blockheight,u32,
|