2021-12-04 12:27:32 +01:00
|
|
|
#include <bitcoin/block.h>
|
2022-03-22 21:27:29 +01:00
|
|
|
#include <common/channel_id.h>
|
2020-08-25 04:16:22 +02:00
|
|
|
#include <common/cryptomsg.h>
|
|
|
|
#include <common/features.h>
|
2021-12-04 12:27:32 +01:00
|
|
|
#include <common/node_id.h>
|
2020-08-25 04:16:22 +02:00
|
|
|
#include <common/wireaddr.h>
|
2022-01-29 04:32:32 +01:00
|
|
|
#include <wire/onion_wire.h>
|
2020-08-25 04:16:22 +02:00
|
|
|
|
|
|
|
msgtype,connectd_init,2000
|
|
|
|
msgdata,connectd_init,chainparams,chainparams,
|
|
|
|
msgdata,connectd_init,our_features,feature_set,
|
|
|
|
msgdata,connectd_init,id,node_id,
|
|
|
|
msgdata,connectd_init,num_wireaddrs,u16,
|
|
|
|
msgdata,connectd_init,wireaddrs,wireaddr_internal,num_wireaddrs
|
|
|
|
msgdata,connectd_init,listen_announce,enum addr_listen_announce,num_wireaddrs
|
|
|
|
msgdata,connectd_init,tor_proxyaddr,?wireaddr,
|
|
|
|
msgdata,connectd_init,use_tor_proxy_always,bool,
|
|
|
|
msgdata,connectd_init,dev_allow_localhost,bool,
|
|
|
|
msgdata,connectd_init,use_dns,bool,
|
|
|
|
msgdata,connectd_init,tor_password,wirestring,
|
2020-09-11 08:48:12 +02:00
|
|
|
msgdata,connectd_init,timeout_secs,u32,
|
2021-10-15 07:49:05 +02:00
|
|
|
msgdata,connectd_init,websocket_helper,wirestring,
|
2022-04-20 13:02:04 +02:00
|
|
|
msgdata,connectd_init,announce_websocket,bool,
|
2022-01-08 14:28:29 +01:00
|
|
|
msgdata,connectd_init,dev_fast_gossip,bool,
|
2022-01-08 14:25:29 +01:00
|
|
|
# If this is set, then fd 5 is dev_disconnect_fd.
|
|
|
|
msgdata,connectd_init,dev_disconnect,bool,
|
2022-03-25 04:11:55 +01:00
|
|
|
msgdata,connectd_init,dev_no_ping_timer,bool,
|
2024-05-14 06:32:37 +02:00
|
|
|
# Allow incoming connections, but don't talk.
|
|
|
|
msgdata,connectd_init,dev_noreply,bool,
|
2024-07-09 15:10:29 +02:00
|
|
|
msgdata,connectd_init,dev_throttle_gossip,bool,
|
2020-08-25 04:16:22 +02:00
|
|
|
|
|
|
|
# Connectd->master, here are the addresses I bound, can announce.
|
|
|
|
msgtype,connectd_init_reply,2100
|
|
|
|
msgdata,connectd_init_reply,num_bindings,u16,
|
|
|
|
msgdata,connectd_init_reply,bindings,wireaddr_internal,num_bindings
|
2022-02-23 17:58:41 +01:00
|
|
|
msgdata,connectd_init_reply,num_announceable,u16,
|
|
|
|
msgdata,connectd_init_reply,announceable,wireaddr,num_announceable
|
2022-03-03 11:24:11 +01:00
|
|
|
msgdata,connectd_init_reply,failmsg,?wirestring,
|
2020-08-25 04:16:22 +02:00
|
|
|
|
|
|
|
# Activate the connect daemon, so others can connect.
|
|
|
|
msgtype,connectd_activate,2025
|
|
|
|
# Do we listen?
|
|
|
|
msgdata,connectd_activate,listen,bool,
|
|
|
|
|
2023-10-23 13:29:51 +02:00
|
|
|
# Set the allowed (i.e. don't hang up on!) unknown messages.
|
|
|
|
msgtype,connectd_set_custommsgs,2007
|
|
|
|
msgdata,connectd_set_custommsgs,len,u32,
|
|
|
|
msgdata,connectd_set_custommsgs,msgnums,u16,len
|
|
|
|
|
2020-08-25 04:16:22 +02:00
|
|
|
# Connectd->master, I am ready.
|
|
|
|
msgtype,connectd_activate_reply,2125
|
2022-03-04 07:10:57 +01:00
|
|
|
msgdata,connectd_activate_reply,failmsg,?wirestring,
|
2020-08-25 04:16:22 +02:00
|
|
|
|
2024-07-10 04:55:23 +02:00
|
|
|
# lightningd -> connectd: here's an SCID->peer mapping for onion messages
|
|
|
|
msgtype,connectd_scid_map,2024
|
|
|
|
msgdata,connectd_scid_map,scid,short_channel_id,
|
|
|
|
msgdata,connectd_scid_map,node_id,node_id,
|
|
|
|
|
2020-08-25 04:16:22 +02:00
|
|
|
# Master -> connectd: connect to a peer.
|
|
|
|
msgtype,connectd_connect_to_peer,2001
|
|
|
|
msgdata,connectd_connect_to_peer,id,node_id,
|
2022-01-11 02:15:48 +01:00
|
|
|
msgdata,connectd_connect_to_peer,len,u32,
|
|
|
|
msgdata,connectd_connect_to_peer,addrs,wireaddr,len
|
2020-08-25 04:16:22 +02:00
|
|
|
msgdata,connectd_connect_to_peer,addrhint,?wireaddr_internal,
|
2022-12-19 21:12:39 +01:00
|
|
|
msgdata,connectd_connect_to_peer,dns_fallback,bool,
|
2024-05-14 06:31:44 +02:00
|
|
|
msgdata,connectd_connect_to_peer,transient,bool,
|
2020-08-25 04:16:22 +02:00
|
|
|
|
|
|
|
# Connectd->master: connect failed.
|
|
|
|
msgtype,connectd_connect_failed,2020
|
|
|
|
msgdata,connectd_connect_failed,id,node_id,
|
2022-09-18 02:20:50 +02:00
|
|
|
msgdata,connectd_connect_failed,failcode,enum jsonrpc_errcode,
|
2020-08-25 04:16:22 +02:00
|
|
|
msgdata,connectd_connect_failed,failreason,wirestring,
|
|
|
|
msgdata,connectd_connect_failed,addrhint,?wireaddr_internal,
|
|
|
|
|
2022-03-22 21:27:29 +01:00
|
|
|
# Connectd -> master: we got a peer.
|
2020-08-25 04:16:22 +02:00
|
|
|
msgtype,connectd_peer_connected,2002
|
|
|
|
msgdata,connectd_peer_connected,id,node_id,
|
2022-07-18 14:12:27 +02:00
|
|
|
msgdata,connectd_peer_connected,counter,u64,
|
2020-08-25 04:16:22 +02:00
|
|
|
msgdata,connectd_peer_connected,addr,wireaddr_internal,
|
2021-10-12 13:16:37 +02:00
|
|
|
msgdata,connectd_peer_connected,remote_addr,?wireaddr,
|
2021-03-25 04:53:31 +01:00
|
|
|
msgdata,connectd_peer_connected,incoming,bool,
|
2020-08-25 04:16:22 +02:00
|
|
|
msgdata,connectd_peer_connected,flen,u16,
|
|
|
|
msgdata,connectd_peer_connected,features,u8,flen
|
|
|
|
|
2022-03-22 21:26:30 +01:00
|
|
|
# connectd -> master: peer disconnected.
|
|
|
|
msgtype,connectd_peer_disconnect_done,2006
|
|
|
|
msgdata,connectd_peer_disconnect_done,id,node_id,
|
2022-07-18 14:12:27 +02:00
|
|
|
msgdata,connectd_peer_disconnect_done,counter,u64,
|
2022-03-22 21:26:30 +01:00
|
|
|
|
2022-07-18 14:12:18 +02:00
|
|
|
# Master -> connectd: make peer active immediately (we want to talk) (+ fd to subd).
|
|
|
|
msgtype,connectd_peer_connect_subd,2004
|
|
|
|
msgdata,connectd_peer_connect_subd,id,node_id,
|
2022-07-18 14:12:27 +02:00
|
|
|
msgdata,connectd_peer_connect_subd,counter,u64,
|
2022-07-18 14:12:18 +02:00
|
|
|
msgdata,connectd_peer_connect_subd,channel_id,channel_id,
|
2022-03-22 21:27:29 +01:00
|
|
|
|
2022-07-18 14:12:18 +02:00
|
|
|
# Connectd -> master: peer said something interesting
|
|
|
|
msgtype,connectd_peer_spoke,2005
|
|
|
|
msgdata,connectd_peer_spoke,id,node_id,
|
2022-07-18 14:12:27 +02:00
|
|
|
msgdata,connectd_peer_spoke,counter,u64,
|
2022-07-18 14:12:18 +02:00
|
|
|
msgdata,connectd_peer_spoke,msgtype,u16,
|
|
|
|
msgdata,connectd_peer_spoke,channel_id,channel_id,
|
2023-10-22 06:07:32 +02:00
|
|
|
# If msgtype == WIRE_ERROR, this is the string.
|
|
|
|
msgdata,connectd_peer_spoke,error,?wirestring,
|
2022-03-22 21:27:29 +01:00
|
|
|
|
2022-03-22 21:26:16 +01:00
|
|
|
# master -> connectd: peer no longer wanted, you can disconnect.
|
|
|
|
msgtype,connectd_discard_peer,2015
|
|
|
|
msgdata,connectd_discard_peer,id,node_id,
|
2022-07-18 14:12:27 +02:00
|
|
|
msgdata,connectd_discard_peer,counter,u64,
|
2020-08-25 04:16:22 +02:00
|
|
|
|
2024-01-31 04:16:17 +01:00
|
|
|
# master -> connectd: give message to peer.
|
|
|
|
msgtype,connectd_peer_send_msg,2003
|
|
|
|
msgdata,connectd_peer_send_msg,id,node_id,
|
|
|
|
msgdata,connectd_peer_send_msg,counter,u64,
|
|
|
|
msgdata,connectd_peer_send_msg,len,u16,
|
|
|
|
msgdata,connectd_peer_send_msg,msg,u8,len
|
2021-06-03 04:01:16 +02:00
|
|
|
|
2020-08-25 04:16:22 +02:00
|
|
|
# master -> connectd: do you have a memleak?
|
|
|
|
msgtype,connectd_dev_memleak,2033
|
|
|
|
|
|
|
|
msgtype,connectd_dev_memleak_reply,2133
|
|
|
|
msgdata,connectd_dev_memleak_reply,leak,bool,
|
2022-01-29 04:31:32 +01:00
|
|
|
|
2023-04-09 06:23:39 +02:00
|
|
|
# master -> connectd: dump status of your fds.
|
|
|
|
msgtype,connectd_dev_report_fds,2034
|
|
|
|
|
2022-01-29 04:31:32 +01:00
|
|
|
# Ping/pong test. Waits for a reply if it expects one.
|
|
|
|
msgtype,connectd_ping,2030
|
|
|
|
msgdata,connectd_ping,id,node_id,
|
|
|
|
msgdata,connectd_ping,num_pong_bytes,u16,
|
|
|
|
msgdata,connectd_ping,len,u16,
|
|
|
|
|
|
|
|
msgtype,connectd_ping_reply,2130
|
|
|
|
# False if we there was already a ping in progress.
|
|
|
|
msgdata,connectd_ping_reply,sent,bool,
|
|
|
|
# 0 == no pong expected, otherwise length of pong.
|
|
|
|
msgdata,connectd_ping_reply,totlen,u16,
|
2022-01-29 04:32:32 +01:00
|
|
|
|
|
|
|
# We tell lightningd we got an onionmsg
|
|
|
|
msgtype,connectd_got_onionmsg_to_us,2145
|
2022-11-09 02:30:10 +01:00
|
|
|
msgdata,connectd_got_onionmsg_to_us,path_secret,?secret,
|
2022-10-17 02:44:39 +02:00
|
|
|
msgdata,connectd_got_onionmsg_to_us,reply,?blinded_path,
|
2022-01-29 04:32:32 +01:00
|
|
|
msgdata,connectd_got_onionmsg_to_us,rawmsg_len,u16,
|
|
|
|
msgdata,connectd_got_onionmsg_to_us,rawmsg,u8,rawmsg_len
|
|
|
|
|
|
|
|
# Lightningd tells us to send an onion message.
|
|
|
|
msgtype,connectd_send_onionmsg,2041
|
|
|
|
msgdata,connectd_send_onionmsg,id,node_id,
|
|
|
|
msgdata,connectd_send_onionmsg,onion_len,u16,
|
|
|
|
msgdata,connectd_send_onionmsg,onion,u8,onion_len
|
2024-10-15 01:24:26 +02:00
|
|
|
msgdata,connectd_send_onionmsg,path_key,pubkey,
|
2022-01-29 04:32:32 +01:00
|
|
|
|
2024-07-10 04:53:19 +02:00
|
|
|
# Lightningd tells us to digest an onion message.
|
|
|
|
msgtype,connectd_inject_onionmsg,2042
|
2024-10-15 01:24:26 +02:00
|
|
|
msgdata,connectd_inject_onionmsg,path_key,pubkey,
|
2024-07-10 04:53:19 +02:00
|
|
|
msgdata,connectd_inject_onionmsg,onion_len,u16,
|
|
|
|
msgdata,connectd_inject_onionmsg,onion,u8,onion_len
|
|
|
|
|
|
|
|
# Reply. If error isn't empty, something went wrong.
|
|
|
|
msgtype,connectd_inject_onionmsg_reply,2142
|
|
|
|
msgdata,connectd_inject_onionmsg_reply,err,wirestring,
|
|
|
|
|
2022-01-29 04:33:05 +01:00
|
|
|
# A custom message that we got from a peer and don't know how to handle, so we
|
|
|
|
# forward it to the master for further handling.
|
|
|
|
msgtype,connectd_custommsg_in,2110
|
|
|
|
msgdata,connectd_custommsg_in,id,node_id,
|
|
|
|
msgdata,connectd_custommsg_in,msg_len,u16,
|
|
|
|
msgdata,connectd_custommsg_in,msg,u8,msg_len
|
|
|
|
|
|
|
|
# A custom message that the lightningd tells us to send to the peer.
|
|
|
|
msgtype,connectd_custommsg_out,2011
|
|
|
|
msgdata,connectd_custommsg_out,id,node_id,
|
|
|
|
msgdata,connectd_custommsg_out,msg_len,u16,
|
|
|
|
msgdata,connectd_custommsg_out,msg,u8,msg_len
|
2022-03-31 07:56:22 +02:00
|
|
|
|
2023-02-03 04:38:39 +01:00
|
|
|
# master -> connectd: we're shutting down, no new connections.
|
|
|
|
msgtype,connectd_start_shutdown,2031
|
|
|
|
|
|
|
|
# connect - >master: acknowledged.
|
|
|
|
msgtype,connectd_start_shutdown_reply,2131
|
|
|
|
|
2022-03-31 07:56:22 +02:00
|
|
|
# master -> connect: stop sending gossip.
|
|
|
|
msgtype,connectd_dev_suppress_gossip,2032
|
|
|
|
|
2024-05-14 06:31:44 +02:00
|
|
|
# master -> connect: waste all your fds.
|
|
|
|
msgtype,connectd_dev_exhaust_fds,2036
|
2024-07-09 15:15:29 +02:00
|
|
|
|
|
|
|
# master -> connect: set artificial maximum reply_channel_range size.
|
|
|
|
msgtype,connectd_dev_set_max_scids_encode_size,2035
|
|
|
|
msgdata,connectd_dev_set_max_scids_encode_size,max,u32,
|