Browse Source

gossipd: split wire types into msgs from lightningd and msgs from per-peer daemons

This avoids some very ugly switch() statements which mixed the two,
but we also take the chance to rename 'towire_gossip_' to
'towire_gossipd_' for those inter-daemon messages; they're messages to
gossipd, not gossip messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
trytravis
Rusty Russell 6 years ago
parent
commit
5c60d7ffb2
  1. 2
      channeld/Makefile
  2. 36
      channeld/channeld.c
  3. 5
      closingd/Makefile
  4. 4
      common/read_peer_msg.c
  5. 11
      gossipd/Makefile
  6. 4
      gossipd/gossip_constants.h
  7. 32
      gossipd/gossip_peerd_wire.csv
  8. 3
      gossipd/gossip_store.c
  9. 33
      gossipd/gossip_wire.csv
  10. 71
      gossipd/gossipd.c
  11. 5
      gossipd/routing.c
  12. 4
      gossipd/routing.h
  13. 6
      gossipd/test/run-bench-find_route.c
  14. 6
      gossipd/test/run-find_route-specific.c
  15. 6
      gossipd/test/run-find_route.c
  16. 8
      lightningd/gossip_control.c
  17. 2
      openingd/Makefile

2
channeld/Makefile

@ -71,7 +71,7 @@ CHANNELD_COMMON_OBJS := \
common/version.o \ common/version.o \
common/wire_error.o \ common/wire_error.o \
common/wireaddr.o \ common/wireaddr.o \
gossipd/gen_gossip_wire.o \ gossipd/gen_gossip_peerd_wire.o \
hsmd/gen_hsm_wire.o \ hsmd/gen_hsm_wire.o \
lightningd/gossip_msg.o \ lightningd/gossip_msg.o \
wire/fromwire.o \ wire/fromwire.o \

36
channeld/channeld.c

@ -43,7 +43,7 @@
#include <common/wire_error.h> #include <common/wire_error.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gossip_constants.h> #include <gossipd/gossip_constants.h>
#include <hsmd/gen_hsm_wire.h> #include <hsmd/gen_hsm_wire.h>
#include <inttypes.h> #include <inttypes.h>
@ -260,15 +260,15 @@ static void send_channel_update(struct peer *peer, int disable_flag)
assert(peer->short_channel_ids[LOCAL].u64); assert(peer->short_channel_ids[LOCAL].u64);
msg = towire_gossip_local_channel_update(NULL, msg = towire_gossipd_local_channel_update(NULL,
&peer->short_channel_ids[LOCAL], &peer->short_channel_ids[LOCAL],
disable_flag disable_flag
== ROUTING_FLAGS_DISABLED, == ROUTING_FLAGS_DISABLED,
peer->cltv_delta, peer->cltv_delta,
peer->conf[REMOTE].htlc_minimum_msat, peer->conf[REMOTE].htlc_minimum_msat,
peer->fee_base, peer->fee_base,
peer->fee_per_satoshi, peer->fee_per_satoshi,
advertised_htlc_max( advertised_htlc_max(
peer->channel->funding_msat, peer->channel->funding_msat,
&peer->conf[LOCAL], &peer->conf[LOCAL],
&peer->conf[REMOTE])); &peer->conf[REMOTE]));
@ -290,10 +290,10 @@ static void make_channel_local_active(struct peer *peer)
u8 *msg; u8 *msg;
/* Tell gossipd about local channel. */ /* Tell gossipd about local channel. */
msg = towire_gossip_local_add_channel(NULL, msg = towire_gossipd_local_add_channel(NULL,
&peer->short_channel_ids[LOCAL], &peer->short_channel_ids[LOCAL],
&peer->node_ids[REMOTE], &peer->node_ids[REMOTE],
peer->channel->funding_msat / 1000); peer->channel->funding_msat / 1000);
wire_sync_write(GOSSIP_FD, take(msg)); wire_sync_write(GOSSIP_FD, take(msg));
/* Tell gossipd and the other side what parameters we expect should /* Tell gossipd and the other side what parameters we expect should
@ -741,7 +741,7 @@ static u8 *master_wait_sync_reply(const tal_t *ctx,
static u8 *gossipd_wait_sync_reply(const tal_t *ctx, static u8 *gossipd_wait_sync_reply(const tal_t *ctx,
struct peer *peer, const u8 *msg, struct peer *peer, const u8 *msg,
enum gossip_wire_type replytype) enum gossip_peerd_wire_type replytype)
{ {
return wait_sync_reply(ctx, msg, replytype, return wait_sync_reply(ctx, msg, replytype,
GOSSIP_FD, peer->from_gossipd, "gossipd"); GOSSIP_FD, peer->from_gossipd, "gossipd");
@ -753,10 +753,10 @@ static u8 *foreign_channel_update(const tal_t *ctx,
{ {
u8 *msg, *update, *channel_update; u8 *msg, *update, *channel_update;
msg = towire_gossip_get_update(NULL, scid); msg = towire_gossipd_get_update(NULL, scid);
msg = gossipd_wait_sync_reply(tmpctx, peer, take(msg), msg = gossipd_wait_sync_reply(tmpctx, peer, take(msg),
WIRE_GOSSIP_GET_UPDATE_REPLY); WIRE_GOSSIPD_GET_UPDATE_REPLY);
if (!fromwire_gossip_get_update_reply(ctx, msg, &update)) if (!fromwire_gossipd_get_update_reply(ctx, msg, &update))
status_failed(STATUS_FAIL_GOSSIP_IO, status_failed(STATUS_FAIL_GOSSIP_IO,
"Invalid update reply"); "Invalid update reply");

5
closingd/Makefile

@ -71,9 +71,8 @@ CLOSINGD_COMMON_OBJS := \
common/version.o \ common/version.o \
common/wire_error.o \ common/wire_error.o \
common/wireaddr.o \ common/wireaddr.o \
gossipd/gen_gossip_wire.o \ gossipd/gen_gossip_peerd_wire.o \
hsmd/gen_hsm_wire.o \ hsmd/gen_hsm_wire.o
lightningd/gossip_msg.o
closingd/gen_closing_wire.h: $(WIRE_GEN) closingd/closing_wire.csv closingd/gen_closing_wire.h: $(WIRE_GEN) closingd/closing_wire.csv
$(WIRE_GEN) --header $@ closing_wire_type < closingd/closing_wire.csv > $@ $(WIRE_GEN) --header $@ closing_wire_type < closingd/closing_wire.csv > $@

4
common/read_peer_msg.c

@ -6,7 +6,7 @@
#include <common/utils.h> #include <common/utils.h>
#include <common/wire_error.h> #include <common/wire_error.h>
#include <errno.h> #include <errno.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_peerd_wire.h>
#include <sys/select.h> #include <sys/select.h>
#include <wire/peer_wire.h> #include <wire/peer_wire.h>
#include <wire/wire_sync.h> #include <wire/wire_sync.h>
@ -84,7 +84,7 @@ void handle_gossip_msg(int peer_fd, struct crypto_state *cs, const u8 *msg TAKES
{ {
u8 *gossip; u8 *gossip;
if (!fromwire_gossip_send_gossip(tmpctx, msg, &gossip)) { if (!fromwire_gossipd_send_gossip(tmpctx, msg, &gossip)) {
status_broken("Got bad message from gossipd: %s", status_broken("Got bad message from gossipd: %s",
tal_hex(msg, msg)); tal_hex(msg, msg));
peer_failed_connection_lost(); peer_failed_connection_lost();

11
gossipd/Makefile

@ -6,13 +6,14 @@ gossipd-wrongdir:
default: gossipd-all default: gossipd-all
# Control daemon uses this: # lightningd uses this:
LIGHTNINGD_GOSSIP_CONTROL_HEADERS := gossipd/gen_gossip_wire.h gossipd/gossip_constants.h LIGHTNINGD_GOSSIP_CONTROL_HEADERS := gossipd/gen_gossip_wire.h gossipd/gossip_constants.h
LIGHTNINGD_GOSSIP_CONTROL_SRC := gossipd/gen_gossip_wire.c LIGHTNINGD_GOSSIP_CONTROL_SRC := gossipd/gen_gossip_wire.c
LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o) LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o)
# gossipd needs these: # gossipd needs these:
LIGHTNINGD_GOSSIP_HEADERS := gossipd/gen_gossip_wire.h \ LIGHTNINGD_GOSSIP_HEADERS := gossipd/gen_gossip_wire.h \
gossipd/gen_gossip_peerd_wire.h \
gossipd/gen_gossip_store.h \ gossipd/gen_gossip_store.h \
gossipd/gossip_store.h \ gossipd/gossip_store.h \
gossipd/routing.h \ gossipd/routing.h \
@ -23,7 +24,7 @@ LIGHTNINGD_GOSSIP_OBJS := $(LIGHTNINGD_GOSSIP_SRC:.c=.o)
# Make sure these depend on everything. # Make sure these depend on everything.
ALL_OBJS += $(LIGHTNINGD_GOSSIP_OBJS) ALL_OBJS += $(LIGHTNINGD_GOSSIP_OBJS)
ALL_PROGRAMS += lightningd/lightning_gossipd ALL_PROGRAMS += lightningd/lightning_gossipd
ALL_GEN_HEADERS += gossipd/gen_gossip_wire.h ALL_GEN_HEADERS += gossipd/gen_gossip_wire.h gossipd/gen_gossip_peerd_wire.h
# For checking # For checking
LIGHTNINGD_GOSSIP_ALLSRC_NOGEN := $(filter-out gossipd/gen_%, $(LIGHTNINGD_GOSSIP_CLIENT_SRC) $(LIGHTNINGD_GOSSIP_SRC)) LIGHTNINGD_GOSSIP_ALLSRC_NOGEN := $(filter-out gossipd/gen_%, $(LIGHTNINGD_GOSSIP_CLIENT_SRC) $(LIGHTNINGD_GOSSIP_SRC))
@ -79,6 +80,12 @@ gossipd/gen_gossip_wire.h: $(WIRE_GEN) gossipd/gossip_wire.csv
gossipd/gen_gossip_wire.c: $(WIRE_GEN) gossipd/gossip_wire.csv gossipd/gen_gossip_wire.c: $(WIRE_GEN) gossipd/gossip_wire.csv
$(WIRE_GEN) ${@:.c=.h} gossip_wire_type < gossipd/gossip_wire.csv > $@ $(WIRE_GEN) ${@:.c=.h} gossip_wire_type < gossipd/gossip_wire.csv > $@
gossipd/gen_gossip_peerd_wire.h: $(WIRE_GEN) gossipd/gossip_peerd_wire.csv
$(WIRE_GEN) --header $@ gossip_peerd_wire_type < gossipd/gossip_peerd_wire.csv > $@
gossipd/gen_gossip_peerd_wire.c: $(WIRE_GEN) gossipd/gossip_peerd_wire.csv
$(WIRE_GEN) ${@:.c=.h} gossip_peerd_wire_type < gossipd/gossip_peerd_wire.csv > $@
gossipd/gen_gossip_store.h: $(WIRE_GEN) gossipd/gossip_store.csv gossipd/gen_gossip_store.h: $(WIRE_GEN) gossipd/gossip_store.csv
$(WIRE_GEN) --header $@ gossip_store_type < gossipd/gossip_store.csv > $@ $(WIRE_GEN) --header $@ gossip_store_type < gossipd/gossip_store.csv > $@

4
gossipd/gossip_constants.h

@ -40,4 +40,8 @@
*/ */
#define ANNOUNCE_MIN_DEPTH 6 #define ANNOUNCE_MIN_DEPTH 6
/* Utility function that, given a source and a destination, gives us
* the direction bit the matching channel should get */
#define get_channel_direction(from, to) (pubkey_cmp(from, to) > 0)
#endif /* LIGHTNING_GOSSIPD_GOSSIP_CONSTANTS_H */ #endif /* LIGHTNING_GOSSIPD_GOSSIP_CONSTANTS_H */

32
gossipd/gossip_peerd_wire.csv

@ -0,0 +1,32 @@
# Channel daemon can ask for updates for a specific channel, for sending
# errors. Must be distinct from WIRE_CHANNEL_ANNOUNCEMENT etc. gossip msgs!
gossipd_get_update,3501
gossipd_get_update,,short_channel_id,struct short_channel_id
# If channel isn't known, update will be empty.
gossipd_get_update_reply,3601
gossipd_get_update_reply,,len,u16
gossipd_get_update_reply,,update,len*u8
# Gossipd can tell channeld etc about gossip to fwd.
gossipd_send_gossip,3502
gossipd_send_gossip,,len,u16
gossipd_send_gossip,,gossip,len*u8
# Both sides have seen the funding tx being locked, but we have not
# yet reached the announcement depth. So we add the channel locally so
# we (and peer) can update it already.
gossipd_local_add_channel,3503
gossipd_local_add_channel,,short_channel_id,struct short_channel_id
gossipd_local_add_channel,,remote_node_id,struct pubkey
gossipd_local_add_channel,,satoshis,u64
# Send this channel_update.
gossipd_local_channel_update,3504
gossipd_local_channel_update,,short_channel_id,struct short_channel_id
gossipd_local_channel_update,,disable,bool
gossipd_local_channel_update,,cltv_expiry_delta,u16
gossipd_local_channel_update,,htlc_minimum_msat,u64
gossipd_local_channel_update,,fee_base_msat,u32
gossipd_local_channel_update,,fee_proportional_millionths,u32
gossipd_local_channel_update,,htlc_maximum_msat,u64
Can't render this file because it has a wrong number of fields in line 2.

3
gossipd/gossip_store.c

@ -7,6 +7,7 @@
#include <common/utils.h> #include <common/utils.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gen_gossip_store.h> #include <gossipd/gen_gossip_store.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_wire.h>
#include <stdio.h> #include <stdio.h>
@ -130,7 +131,7 @@ static bool gossip_store_append(int fd, struct routing_state *rstate, const u8 *
msg = towire_gossip_store_channel_update(tmpctx, gossip_msg); msg = towire_gossip_store_channel_update(tmpctx, gossip_msg);
else if(t == WIRE_NODE_ANNOUNCEMENT) else if(t == WIRE_NODE_ANNOUNCEMENT)
msg = towire_gossip_store_node_announcement(tmpctx, gossip_msg); msg = towire_gossip_store_node_announcement(tmpctx, gossip_msg);
else if(t == WIRE_GOSSIP_LOCAL_ADD_CHANNEL) else if(t == WIRE_GOSSIPD_LOCAL_ADD_CHANNEL)
msg = towire_gossip_store_local_add_channel(tmpctx, gossip_msg); msg = towire_gossip_store_local_add_channel(tmpctx, gossip_msg);
else if(t == WIRE_GOSSIP_STORE_CHANNEL_DELETE) else if(t == WIRE_GOSSIP_STORE_CHANNEL_DELETE)
msg = gossip_msg; msg = gossip_msg;

33
gossipd/gossip_wire.csv

@ -100,38 +100,7 @@ gossip_get_channel_peer,,channel_id,struct short_channel_id
gossip_get_channel_peer_reply,3109 gossip_get_channel_peer_reply,3109
gossip_get_channel_peer_reply,,peer_id,?struct pubkey gossip_get_channel_peer_reply,,peer_id,?struct pubkey
# Channel daemon can ask for updates for a specific channel, for sending # gossipd->master: we're closing this channel.
# errors. Must be distinct from WIRE_CHANNEL_ANNOUNCEMENT etc. gossip msgs!
gossip_get_update,3012
gossip_get_update,,short_channel_id,struct short_channel_id
# If channel isn't known, update will be empty.
gossip_get_update_reply,3112
gossip_get_update_reply,,len,u16
gossip_get_update_reply,,update,len*u8
# Gossipd can tell channeld etc about gossip to fwd.
gossip_send_gossip,3016
gossip_send_gossip,,len,u16
gossip_send_gossip,,gossip,len*u8
# Both sides have seen the funding tx being locked, but we have not
# yet reached the announcement depth. So we add the channel locally so
# we (and peer) can update it already.
gossip_local_add_channel,3017
gossip_local_add_channel,,short_channel_id,struct short_channel_id
gossip_local_add_channel,,remote_node_id,struct pubkey
gossip_local_add_channel,,satoshis,u64
gossip_local_channel_update,3026
gossip_local_channel_update,,short_channel_id,struct short_channel_id
gossip_local_channel_update,,disable,bool
gossip_local_channel_update,,cltv_expiry_delta,u16
gossip_local_channel_update,,htlc_minimum_msat,u64
gossip_local_channel_update,,fee_base_msat,u32
gossip_local_channel_update,,fee_proportional_millionths,u32
gossip_local_channel_update,,htlc_maximum_msat,u64
gossip_local_channel_close,3027 gossip_local_channel_close,3027
gossip_local_channel_close,,short_channel_id,struct short_channel_id gossip_local_channel_close,,short_channel_id,struct short_channel_id

Can't render this file because it has a wrong number of fields in line 6.

71
gossipd/gossipd.c

@ -36,6 +36,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <gossipd/broadcast.h> #include <gossipd/broadcast.h>
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_wire.h>
#include <gossipd/routing.h> #include <gossipd/routing.h>
#include <hsmd/gen_hsm_wire.h> #include <hsmd/gen_hsm_wire.h>
@ -174,7 +175,7 @@ static struct peer *find_peer(struct daemon *daemon, const struct pubkey *id)
static void queue_peer_msg(struct peer *peer, const u8 *msg TAKES) static void queue_peer_msg(struct peer *peer, const u8 *msg TAKES)
{ {
const u8 *send = towire_gossip_send_gossip(NULL, msg); const u8 *send = towire_gossipd_send_gossip(NULL, msg);
if (taken(msg)) if (taken(msg))
tal_free(msg); tal_free(msg);
daemon_conn_send(peer->dc, take(send)); daemon_conn_send(peer->dc, take(send));
@ -1048,7 +1049,7 @@ static bool handle_get_update(struct peer *peer, const u8 *msg)
struct routing_state *rstate = peer->daemon->rstate; struct routing_state *rstate = peer->daemon->rstate;
int direction; int direction;
if (!fromwire_gossip_get_update(msg, &scid)) { if (!fromwire_gossipd_get_update(msg, &scid)) {
status_broken("peer %s sent bad gossip_get_update %s", status_broken("peer %s sent bad gossip_get_update %s",
type_to_string(tmpctx, struct pubkey, &peer->id), type_to_string(tmpctx, struct pubkey, &peer->id),
tal_hex(tmpctx, msg)); tal_hex(tmpctx, msg));
@ -1086,7 +1087,7 @@ out:
type_to_string(tmpctx, struct short_channel_id, &scid), type_to_string(tmpctx, struct short_channel_id, &scid),
update ? "got" : "no"); update ? "got" : "no");
msg = towire_gossip_get_update_reply(NULL, update); msg = towire_gossipd_get_update_reply(NULL, update);
daemon_conn_send(peer->dc, take(msg)); daemon_conn_send(peer->dc, take(msg));
return true; return true;
} }
@ -1119,14 +1120,14 @@ static bool handle_local_channel_update(struct peer *peer, const u8 *msg)
u32 fee_proportional_millionths; u32 fee_proportional_millionths;
int direction; int direction;
if (!fromwire_gossip_local_channel_update(msg, if (!fromwire_gossipd_local_channel_update(msg,
&scid, &scid,
&disable, &disable,
&cltv_expiry_delta, &cltv_expiry_delta,
&htlc_minimum_msat, &htlc_minimum_msat,
&fee_base_msat, &fee_base_msat,
&fee_proportional_millionths, &fee_proportional_millionths,
&htlc_maximum_msat)) { &htlc_maximum_msat)) {
status_broken("peer %s bad local_channel_update %s", status_broken("peer %s bad local_channel_update %s",
type_to_string(tmpctx, struct pubkey, &peer->id), type_to_string(tmpctx, struct pubkey, &peer->id),
tal_hex(tmpctx, msg)); tal_hex(tmpctx, msg));
@ -1244,51 +1245,26 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
} }
/* Must be a gossip_wire_type asking us to do something. */ /* Must be a gossip_wire_type asking us to do something. */
switch ((enum gossip_wire_type)fromwire_peektype(msg)) { switch ((enum gossip_peerd_wire_type)fromwire_peektype(msg)) {
case WIRE_GOSSIP_GET_UPDATE: case WIRE_GOSSIPD_GET_UPDATE:
ok = handle_get_update(peer, msg); ok = handle_get_update(peer, msg);
goto handled_cmd; goto handled_cmd;
case WIRE_GOSSIP_LOCAL_ADD_CHANNEL: case WIRE_GOSSIPD_LOCAL_ADD_CHANNEL:
ok = handle_local_add_channel(peer->daemon->rstate, msg); ok = handle_local_add_channel(peer->daemon->rstate, msg);
if (ok) if (ok)
gossip_store_add(peer->daemon->rstate->store, msg); gossip_store_add(peer->daemon->rstate->store, msg);
goto handled_cmd; goto handled_cmd;
case WIRE_GOSSIP_LOCAL_CHANNEL_UPDATE: case WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE:
ok = handle_local_channel_update(peer, msg); ok = handle_local_channel_update(peer, msg);
goto handled_cmd; goto handled_cmd;
case WIRE_GOSSIPCTL_INIT: case WIRE_GOSSIPD_GET_UPDATE_REPLY:
case WIRE_GOSSIP_GETNODES_REQUEST: case WIRE_GOSSIPD_SEND_GOSSIP:
case WIRE_GOSSIP_GETNODES_REPLY:
case WIRE_GOSSIP_GETROUTE_REQUEST:
case WIRE_GOSSIP_GETROUTE_REPLY:
case WIRE_GOSSIP_GETCHANNELS_REQUEST:
case WIRE_GOSSIP_GETCHANNELS_REPLY:
case WIRE_GOSSIP_PING:
case WIRE_GOSSIP_PING_REPLY:
case WIRE_GOSSIP_QUERY_SCIDS:
case WIRE_GOSSIP_SCIDS_REPLY:
case WIRE_GOSSIP_SEND_TIMESTAMP_FILTER:
case WIRE_GOSSIP_QUERY_CHANNEL_RANGE:
case WIRE_GOSSIP_QUERY_CHANNEL_RANGE_REPLY:
case WIRE_GOSSIP_DEV_SET_MAX_SCIDS_ENCODE_SIZE:
case WIRE_GOSSIP_GET_CHANNEL_PEER:
case WIRE_GOSSIP_GET_CHANNEL_PEER_REPLY:
case WIRE_GOSSIP_GET_INCOMING_CHANNELS:
case WIRE_GOSSIP_GET_INCOMING_CHANNELS_REPLY:
case WIRE_GOSSIP_GET_UPDATE_REPLY:
case WIRE_GOSSIP_SEND_GOSSIP:
case WIRE_GOSSIP_LOCAL_CHANNEL_CLOSE:
case WIRE_GOSSIP_GET_TXOUT:
case WIRE_GOSSIP_GET_TXOUT_REPLY:
case WIRE_GOSSIP_ROUTING_FAILURE:
case WIRE_GOSSIP_MARK_CHANNEL_UNROUTABLE:
case WIRE_GOSSIP_OUTPOINT_SPENT:
case WIRE_GOSSIP_DEV_SUPPRESS:
break; break;
} }
status_broken("peer %s: unexpected cmd of type %s", status_broken("peer %s: unexpected cmd of type %i %s",
type_to_string(tmpctx, struct pubkey, &peer->id), type_to_string(tmpctx, struct pubkey, &peer->id),
gossip_wire_type_name(fromwire_peektype(msg))); fromwire_peektype(msg),
gossip_peerd_wire_type_name(fromwire_peektype(msg)));
return io_close(conn); return io_close(conn);
handled_cmd: handled_cmd:
@ -2179,11 +2155,6 @@ static struct io_plan *recv_req(struct io_conn *conn,
case WIRE_GOSSIP_QUERY_CHANNEL_RANGE_REPLY: case WIRE_GOSSIP_QUERY_CHANNEL_RANGE_REPLY:
case WIRE_GOSSIP_GET_CHANNEL_PEER_REPLY: case WIRE_GOSSIP_GET_CHANNEL_PEER_REPLY:
case WIRE_GOSSIP_GET_INCOMING_CHANNELS_REPLY: case WIRE_GOSSIP_GET_INCOMING_CHANNELS_REPLY:
case WIRE_GOSSIP_GET_UPDATE:
case WIRE_GOSSIP_GET_UPDATE_REPLY:
case WIRE_GOSSIP_SEND_GOSSIP:
case WIRE_GOSSIP_LOCAL_ADD_CHANNEL:
case WIRE_GOSSIP_LOCAL_CHANNEL_UPDATE:
case WIRE_GOSSIP_GET_TXOUT: case WIRE_GOSSIP_GET_TXOUT:
break; break;
} }

5
gossipd/routing.c

@ -12,6 +12,7 @@
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <common/wire_error.h> #include <common/wire_error.h>
#include <common/wireaddr.h> #include <common/wireaddr.h>
#include <gossipd/gen_gossip_peerd_wire.h>
#include <gossipd/gen_gossip_wire.h> #include <gossipd/gen_gossip_wire.h>
#include <inttypes.h> #include <inttypes.h>
#include <wire/gen_peer_wire.h> #include <wire/gen_peer_wire.h>
@ -1712,8 +1713,8 @@ bool handle_local_add_channel(struct routing_state *rstate, const u8 *msg)
struct pubkey remote_node_id; struct pubkey remote_node_id;
u64 satoshis; u64 satoshis;
if (!fromwire_gossip_local_add_channel(msg, &scid, &remote_node_id, if (!fromwire_gossipd_local_add_channel(msg, &scid, &remote_node_id,
&satoshis)) { &satoshis)) {
status_broken("Unable to parse local_add_channel message: %s", status_broken("Unable to parse local_add_channel message: %s",
tal_hex(msg, msg)); tal_hex(msg, msg));
return false; return false;

4
gossipd/routing.h

@ -285,10 +285,6 @@ void mark_channel_unroutable(struct routing_state *rstate,
void route_prune(struct routing_state *rstate); void route_prune(struct routing_state *rstate);
/* Utility function that, given a source and a destination, gives us
* the direction bit the matching channel should get */
#define get_channel_direction(from, to) (pubkey_cmp(from, to) > 0)
/** /**
* Add a channel_announcement to the network view without checking it * Add a channel_announcement to the network view without checking it
* *

6
gossipd/test/run-bench-find_route.c

@ -68,9 +68,9 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *
/* Generated stub for fromwire_channel_update_option_channel_htlc_max */ /* Generated stub for fromwire_channel_update_option_channel_htlc_max */
bool fromwire_channel_update_option_channel_htlc_max(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, u64 *htlc_maximum_msat UNNEEDED) bool fromwire_channel_update_option_channel_htlc_max(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, u64 *htlc_maximum_msat UNNEEDED)
{ fprintf(stderr, "fromwire_channel_update_option_channel_htlc_max called!\n"); abort(); } { fprintf(stderr, "fromwire_channel_update_option_channel_htlc_max called!\n"); abort(); }
/* Generated stub for fromwire_gossip_local_add_channel */ /* Generated stub for fromwire_gossipd_local_add_channel */
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED) bool fromwire_gossipd_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_local_add_channel called!\n"); abort(); } { fprintf(stderr, "fromwire_gossipd_local_add_channel called!\n"); abort(); }
/* Generated stub for fromwire_gossip_store_channel_announcement */ /* Generated stub for fromwire_gossip_store_channel_announcement */
bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED) bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); } { fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); }

6
gossipd/test/run-find_route-specific.c

@ -32,9 +32,9 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *
/* Generated stub for fromwire_channel_update_option_channel_htlc_max */ /* Generated stub for fromwire_channel_update_option_channel_htlc_max */
bool fromwire_channel_update_option_channel_htlc_max(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, u64 *htlc_maximum_msat UNNEEDED) bool fromwire_channel_update_option_channel_htlc_max(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, u64 *htlc_maximum_msat UNNEEDED)
{ fprintf(stderr, "fromwire_channel_update_option_channel_htlc_max called!\n"); abort(); } { fprintf(stderr, "fromwire_channel_update_option_channel_htlc_max called!\n"); abort(); }
/* Generated stub for fromwire_gossip_local_add_channel */ /* Generated stub for fromwire_gossipd_local_add_channel */
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED) bool fromwire_gossipd_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_local_add_channel called!\n"); abort(); } { fprintf(stderr, "fromwire_gossipd_local_add_channel called!\n"); abort(); }
/* Generated stub for fromwire_gossip_store_channel_announcement */ /* Generated stub for fromwire_gossip_store_channel_announcement */
bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED) bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); } { fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); }

6
gossipd/test/run-find_route.c

@ -30,9 +30,9 @@ bool fromwire_channel_update(const void *p UNNEEDED, secp256k1_ecdsa_signature *
/* Generated stub for fromwire_channel_update_option_channel_htlc_max */ /* Generated stub for fromwire_channel_update_option_channel_htlc_max */
bool fromwire_channel_update_option_channel_htlc_max(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, u64 *htlc_maximum_msat UNNEEDED) bool fromwire_channel_update_option_channel_htlc_max(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED, struct bitcoin_blkid *chain_hash UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, u32 *timestamp UNNEEDED, u8 *message_flags UNNEEDED, u8 *channel_flags UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, u64 *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, u64 *htlc_maximum_msat UNNEEDED)
{ fprintf(stderr, "fromwire_channel_update_option_channel_htlc_max called!\n"); abort(); } { fprintf(stderr, "fromwire_channel_update_option_channel_htlc_max called!\n"); abort(); }
/* Generated stub for fromwire_gossip_local_add_channel */ /* Generated stub for fromwire_gossipd_local_add_channel */
bool fromwire_gossip_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED) bool fromwire_gossipd_local_add_channel(const void *p UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, struct pubkey *remote_node_id UNNEEDED, u64 *satoshis UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_local_add_channel called!\n"); abort(); } { fprintf(stderr, "fromwire_gossipd_local_add_channel called!\n"); abort(); }
/* Generated stub for fromwire_gossip_store_channel_announcement */ /* Generated stub for fromwire_gossip_store_channel_announcement */
bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED) bool fromwire_gossip_store_channel_announcement(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **announcement UNNEEDED, u64 *satoshis UNNEEDED)
{ fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); } { fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); }

8
lightningd/gossip_control.c

@ -107,8 +107,6 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
case WIRE_GOSSIP_GETCHANNELS_REQUEST: case WIRE_GOSSIP_GETCHANNELS_REQUEST:
case WIRE_GOSSIP_PING: case WIRE_GOSSIP_PING:
case WIRE_GOSSIP_GET_CHANNEL_PEER: case WIRE_GOSSIP_GET_CHANNEL_PEER:
case WIRE_GOSSIP_GET_UPDATE:
case WIRE_GOSSIP_SEND_GOSSIP:
case WIRE_GOSSIP_GET_TXOUT_REPLY: case WIRE_GOSSIP_GET_TXOUT_REPLY:
case WIRE_GOSSIP_OUTPOINT_SPENT: case WIRE_GOSSIP_OUTPOINT_SPENT:
case WIRE_GOSSIP_ROUTING_FAILURE: case WIRE_GOSSIP_ROUTING_FAILURE:
@ -119,8 +117,8 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
case WIRE_GOSSIP_GET_INCOMING_CHANNELS: case WIRE_GOSSIP_GET_INCOMING_CHANNELS:
case WIRE_GOSSIP_DEV_SET_MAX_SCIDS_ENCODE_SIZE: case WIRE_GOSSIP_DEV_SET_MAX_SCIDS_ENCODE_SIZE:
case WIRE_GOSSIP_DEV_SUPPRESS: case WIRE_GOSSIP_DEV_SUPPRESS:
case WIRE_GOSSIP_LOCAL_CHANNEL_CLOSE:
/* This is a reply, so never gets through to here. */ /* This is a reply, so never gets through to here. */
case WIRE_GOSSIP_GET_UPDATE_REPLY:
case WIRE_GOSSIP_GETNODES_REPLY: case WIRE_GOSSIP_GETNODES_REPLY:
case WIRE_GOSSIP_GETROUTE_REPLY: case WIRE_GOSSIP_GETROUTE_REPLY:
case WIRE_GOSSIP_GETCHANNELS_REPLY: case WIRE_GOSSIP_GETCHANNELS_REPLY:
@ -128,10 +126,6 @@ static unsigned gossip_msg(struct subd *gossip, const u8 *msg, const int *fds)
case WIRE_GOSSIP_QUERY_CHANNEL_RANGE_REPLY: case WIRE_GOSSIP_QUERY_CHANNEL_RANGE_REPLY:
case WIRE_GOSSIP_GET_CHANNEL_PEER_REPLY: case WIRE_GOSSIP_GET_CHANNEL_PEER_REPLY:
case WIRE_GOSSIP_GET_INCOMING_CHANNELS_REPLY: case WIRE_GOSSIP_GET_INCOMING_CHANNELS_REPLY:
/* These are inter-daemon messages, not received by us */
case WIRE_GOSSIP_LOCAL_ADD_CHANNEL:
case WIRE_GOSSIP_LOCAL_CHANNEL_UPDATE:
case WIRE_GOSSIP_LOCAL_CHANNEL_CLOSE:
break; break;
case WIRE_GOSSIP_PING_REPLY: case WIRE_GOSSIP_PING_REPLY:

2
openingd/Makefile

@ -69,7 +69,7 @@ OPENINGD_COMMON_OBJS := \
common/version.o \ common/version.o \
common/wire_error.o \ common/wire_error.o \
common/wireaddr.o \ common/wireaddr.o \
gossipd/gen_gossip_wire.o \ gossipd/gen_gossip_peerd_wire.o \
hsmd/gen_hsm_wire.o \ hsmd/gen_hsm_wire.o \
lightningd/gossip_msg.o lightningd/gossip_msg.o

Loading…
Cancel
Save