|
|
|
#include <common/cryptomsg.h>
|
|
|
|
#include <common/wireaddr.h>
|
|
|
|
#include <wire/gen_onion_wire.h>
|
|
|
|
|
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>
7 years ago
|
|
|
# Initialize the gossip daemon.
|
|
|
|
msgtype,gossipctl_init,3000
|
|
|
|
msgdata,gossipctl_init,chainparams,chainparams,
|
|
|
|
msgdata,gossipctl_init,id,node_id,
|
|
|
|
msgdata,gossipctl_init,gflen,u16,
|
|
|
|
msgdata,gossipctl_init,globalfeatures,u8,gflen
|
|
|
|
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,
|
|
|
|
msgdata,gossipctl_init,dev_fast_gossip,bool,
|
|
|
|
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>
7 years ago
|
|
|
|
|
|
|
# In developer mode, we can mess with time.
|
|
|
|
msgtype,gossip_dev_set_time,3001
|
|
|
|
msgdata,gossip_dev_set_time,dev_gossip_time,u32,
|
|
|
|
|
|
|
|
# Pass JSON-RPC getnodes call through
|
|
|
|
msgtype,gossip_getnodes_request,3005
|
|
|
|
msgdata,gossip_getnodes_request,id,?node_id,
|
|
|
|
|
|
|
|
#include <lightningd/gossip_msg.h>
|
|
|
|
msgtype,gossip_getnodes_reply,3105
|
|
|
|
msgdata,gossip_getnodes_reply,num_nodes,u32,
|
|
|
|
msgdata,gossip_getnodes_reply,nodes,gossip_getnodes_entry,num_nodes
|
|
|
|
|
|
|
|
# Pass JSON-RPC getroute call through
|
|
|
|
msgtype,gossip_getroute_request,3006
|
|
|
|
# Source defaults to "us", and means we don't consider first-hop channel fees
|
|
|
|
msgdata,gossip_getroute_request,source,?node_id,
|
|
|
|
msgdata,gossip_getroute_request,destination,node_id,
|
|
|
|
msgdata,gossip_getroute_request,msatoshi,amount_msat,
|
|
|
|
# We don't pass doubles, so pass riskfactor 1000000.
|
|
|
|
msgdata,gossip_getroute_request,riskfactor_by_million,u64,
|
|
|
|
msgdata,gossip_getroute_request,final_cltv,u32,
|
|
|
|
msgdata,gossip_getroute_request,fuzz,double,
|
|
|
|
msgdata,gossip_getroute_request,num_excluded,u16,
|
|
|
|
msgdata,gossip_getroute_request,excluded,exclude_entry,num_excluded
|
|
|
|
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
|
|
|
|
|
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>
7 years ago
|
|
|
# Ping/pong test. Waits for a reply if it expects one.
|
|
|
|
msgtype,gossip_ping,3008
|
|
|
|
msgdata,gossip_ping,id,node_id,
|
|
|
|
msgdata,gossip_ping,num_pong_bytes,u16,
|
|
|
|
msgdata,gossip_ping,len,u16,
|
|
|
|
|
|
|
|
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>
7 years ago
|
|
|
# False if id in gossip_ping was unknown.
|
|
|
|
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>
7 years ago
|
|
|
# 0 == no pong expected
|
|
|
|
msgdata,gossip_ping_reply,totlen,u16,
|
|
|
|
|
|
|
|
# Set artificial maximum reply_channel_range size. Master->gossipd
|
|
|
|
msgtype,gossip_dev_set_max_scids_encode_size,3030
|
|
|
|
msgdata,gossip_dev_set_max_scids_encode_size,max,u32,
|
|
|
|
|
|
|
|
# Given a short_channel_id, return the other endpoint (or none if DNE)
|
|
|
|
msgtype,gossip_get_channel_peer,3009
|
|
|
|
msgdata,gossip_get_channel_peer,channel_id,short_channel_id,
|
|
|
|
|
|
|
|
msgtype,gossip_get_channel_peer_reply,3109
|
|
|
|
msgdata,gossip_get_channel_peer_reply,peer_id,?node_id,
|
|
|
|
|
|
|
|
# gossipd->master: we're closing this channel.
|
|
|
|
msgtype,gossip_local_channel_close,3027
|
|
|
|
msgdata,gossip_local_channel_close,short_channel_id,short_channel_id,
|
|
|
|
|
|
|
|
# Gossipd->master get this tx output please.
|
|
|
|
msgtype,gossip_get_txout,3018
|
|
|
|
msgdata,gossip_get_txout,short_channel_id,short_channel_id,
|
|
|
|
|
|
|
|
# master->gossipd here is the output, or empty if none.
|
|
|
|
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
|
|
|
|
|
|
|
|
# master->gossipd an htlc failed with this onion error.
|
|
|
|
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
|
|
|
|
|
|
|
|
# master -> gossipd: a potential funding outpoint was spent, please forget the eventual channel
|
|
|
|
msgtype,gossip_outpoint_spent,3024
|
|
|
|
msgdata,gossip_outpoint_spent,short_channel_id,short_channel_id,
|
|
|
|
|
|
|
|
# master -> gossipd: stop gossip timers.
|
|
|
|
msgtype,gossip_dev_suppress,3032
|
|
|
|
|
|
|
|
# master -> gossipd: do you have a memleak?
|
|
|
|
msgtype,gossip_dev_memleak,3033
|
|
|
|
|
|
|
|
msgtype,gossip_dev_memleak_reply,3133
|
|
|
|
msgdata,gossip_dev_memleak_reply,leak,bool,
|
|
|
|
|
|
|
|
# master -> gossipd: please rewrite the gossip_store
|
|
|
|
msgtype,gossip_dev_compact_store,3034
|
|
|
|
|
|
|
|
# gossipd -> master: ok
|
|
|
|
msgtype,gossip_dev_compact_store_reply,3134
|
|
|
|
msgdata,gossip_dev_compact_store_reply,success,bool,
|
|
|
|
|
|
|
|
#include <common/bolt11.h>
|
|
|
|
|
|
|
|
# master -> gossipd: get route_info for our incoming channels
|
|
|
|
msgtype,gossip_get_incoming_channels,3025
|
|
|
|
|
|
|
|
# gossipd -> master: here they are.
|
|
|
|
msgtype,gossip_get_incoming_channels_reply,3125
|
|
|
|
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
|
|
|
|
|
|
|
|
# master -> gossipd: blockheight increased.
|
|
|
|
msgtype,gossip_new_blockheight,3026
|
|
|
|
msgdata,gossip_new_blockheight,blockheight,u32,
|