core-lightning/gossipd/gossip_wire.csv
Rusty Russell 59e75f1b2c gossipd: reply to large listchannels in parts.
This has two effects: most importantly, it avoids the problem where
lightningd creates a 800MB JSON blob in response to listchannels,
which causes OOM on the Raspberry Pi (our previous max allocation was
832MB).  This is because lightning-cli can start draining the JSON
while we're filling the buffer, so we end up with a max allocation of
68MB.

But despite being less efficient (multiple queries to gossipd), it
actually speeds things up due to the parallelism:

MCP with -O3 -flto before vs after:
-listchannels_sec:8.980000-9.330000(9.206+/-0.14)
+listchannels_sec:7.500000-7.830000(7.656+/-0.11)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-05-22 11:28:44 +00:00

5.4 KiB

1#include <common/cryptomsg.h>
2#include <common/wireaddr.h>
3#include <wire/gen_onion_wire.h>
4# Initialize the gossip daemon.
5gossipctl_init,3000
6gossipctl_init,,broadcast_interval_msec,u32
7gossipctl_init,,chain_hash,struct bitcoin_blkid
8gossipctl_init,,id,struct node_id
9gossipctl_init,,gflen,u16
10gossipctl_init,,globalfeatures,gflen*u8
11gossipctl_init,,rgb,3*u8
12gossipctl_init,,alias,32*u8
13gossipctl_init,,update_channel_interval,u32
14gossipctl_init,,num_announcable,u16
15gossipctl_init,,announcable,num_announcable*struct wireaddr
16gossipctl_init,,dev_gossip_time,?u32
17# Pass JSON-RPC getnodes call through
18gossip_getnodes_request,3005
19gossip_getnodes_request,,id,?struct node_id
20#include <lightningd/gossip_msg.h>
21gossip_getnodes_reply,3105
22gossip_getnodes_reply,,num_nodes,u32
23gossip_getnodes_reply,,nodes,num_nodes*struct gossip_getnodes_entry
24# Pass JSON-RPC getroute call through
25gossip_getroute_request,3006
26gossip_getroute_request,,source,struct node_id
27gossip_getroute_request,,destination,struct node_id
28gossip_getroute_request,,msatoshi,struct amount_msat
29# We don't pass doubles, so pass riskfactor * 1000000.
30gossip_getroute_request,,riskfactor_by_million,u64
31gossip_getroute_request,,final_cltv,u32
32gossip_getroute_request,,fuzz,double
33gossip_getroute_request,,num_excluded,u16
34gossip_getroute_request,,excluded,num_excluded*struct short_channel_id_dir
35gossip_getroute_request,,max_hops,u32
36gossip_getroute_reply,3106
37gossip_getroute_reply,,num_hops,u16
38gossip_getroute_reply,,hops,num_hops*struct route_hop
39gossip_getchannels_request,3007
40gossip_getchannels_request,,short_channel_id,?struct short_channel_id
41gossip_getchannels_request,,source,?struct node_id
42gossip_getchannels_request,,prev,?struct short_channel_id
43gossip_getchannels_reply,3107
44gossip_getchannels_reply,,complete,bool
45gossip_getchannels_reply,,num_channels,u32
46gossip_getchannels_reply,,nodes,num_channels*struct gossip_getchannels_entry
47# Ping/pong test. Waits for a reply if it expects one.
48gossip_ping,3008
49gossip_ping,,id,struct node_id
50gossip_ping,,num_pong_bytes,u16
51gossip_ping,,len,u16
52gossip_ping_reply,3108
53gossip_ping_reply,,id,struct node_id
54# False if id in gossip_ping was unknown.
55gossip_ping_reply,,sent,bool
56# 0 == no pong expected
57gossip_ping_reply,,totlen,u16
58# Test of query_short_channel_ids. Master->gossipd
59gossip_query_scids,3031
60gossip_query_scids,,id,struct node_id
61gossip_query_scids,,num_ids,u16
62gossip_query_scids,,ids,num_ids*struct short_channel_id
63# Gossipd -> master
64gossip_scids_reply,3131
65gossip_scids_reply,,ok,bool
66gossip_scids_reply,,complete,bool
67# Test gossip timestamp filtering.
68gossip_send_timestamp_filter,3028
69gossip_send_timestamp_filter,,id,struct node_id
70gossip_send_timestamp_filter,,first_timestamp,u32
71gossip_send_timestamp_filter,,timestamp_range,u32
72# Test of query_channel_range. Master->gossipd
73gossip_query_channel_range,3029
74gossip_query_channel_range,,id,struct node_id
75gossip_query_channel_range,,first_blocknum,u32
76gossip_query_channel_range,,number_of_blocks,u32
77# Gossipd -> master
78gossip_query_channel_range_reply,3129
79gossip_query_channel_range_reply,,final_first_block,u32
80gossip_query_channel_range_reply,,final_num_blocks,u32
81gossip_query_channel_range_reply,,final_complete,bool
82gossip_query_channel_range_reply,,num,u16
83gossip_query_channel_range_reply,,scids,num*struct short_channel_id
84# Set artificial maximum reply_channel_range size. Master->gossipd
85gossip_dev_set_max_scids_encode_size,3030
86gossip_dev_set_max_scids_encode_size,,max,u32
87# Given a short_channel_id, return the other endpoint (or none if DNE)
88gossip_get_channel_peer,3009
89gossip_get_channel_peer,,channel_id,struct short_channel_id
90gossip_get_channel_peer_reply,3109
91gossip_get_channel_peer_reply,,peer_id,?struct node_id
92# gossipd->master: we're closing this channel.
93gossip_local_channel_close,3027
94gossip_local_channel_close,,short_channel_id,struct short_channel_id
95# Gossipd->master get this tx output please.
96gossip_get_txout,3018
97gossip_get_txout,,short_channel_id,struct short_channel_id
98# master->gossipd here is the output, or empty if none.
99gossip_get_txout_reply,3118
100gossip_get_txout_reply,,short_channel_id,struct short_channel_id
101gossip_get_txout_reply,,satoshis,struct amount_sat
102gossip_get_txout_reply,,len,u16
103gossip_get_txout_reply,,outscript,len*u8
104# master->gossipd an htlc failed with this onion error.
105gossip_payment_failure,3021
106gossip_payment_failure,,erring_node,struct node_id
107gossip_payment_failure,,erring_channel,struct short_channel_id
108gossip_payment_failure,,erring_channel_direction,u8
109gossip_payment_failure,,len,u16
110gossip_payment_failure,,error,len*u8
111# master -> gossipd: a potential funding outpoint was spent, please forget the eventual channel
112gossip_outpoint_spent,3024
113gossip_outpoint_spent,,short_channel_id,struct short_channel_id
114# master -> gossipd: stop gossip timers.
115gossip_dev_suppress,3032
116# master -> gossipd: do you have a memleak?
117gossip_dev_memleak,3033
118gossip_dev_memleak_reply,3133
119gossip_dev_memleak_reply,,leak,bool
120# master -> gossipd: please rewrite the gossip_store
121gossip_dev_compact_store,3034
122# gossipd -> master: ok
123gossip_dev_compact_store_reply,3134
124gossip_dev_compact_store_reply,,success,bool
125#include <common/bolt11.h>
126# master -> gossipd: get route_info for our incoming channels
127gossip_get_incoming_channels,3025
128gossip_get_incoming_channels,,private_too,?bool
129# gossipd -> master: here they are.
130gossip_get_incoming_channels_reply,3125
131gossip_get_incoming_channels_reply,,num,u16
132gossip_get_incoming_channels_reply,,route_info,num*struct route_info