From 5c60d7ffb2c529abe455dd49fe0ff923d5b3250f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 13 Nov 2018 14:33:51 +1030 Subject: [PATCH] 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 --- channeld/Makefile | 2 +- channeld/channeld.c | 36 ++++++------- closingd/Makefile | 5 +- common/read_peer_msg.c | 4 +- gossipd/Makefile | 11 +++- gossipd/gossip_constants.h | 4 ++ gossipd/gossip_peerd_wire.csv | 32 ++++++++++++ gossipd/gossip_store.c | 3 +- gossipd/gossip_wire.csv | 33 +----------- gossipd/gossipd.c | 71 ++++++++------------------ gossipd/routing.c | 5 +- gossipd/routing.h | 4 -- gossipd/test/run-bench-find_route.c | 6 +-- gossipd/test/run-find_route-specific.c | 6 +-- gossipd/test/run-find_route.c | 6 +-- lightningd/gossip_control.c | 8 +-- openingd/Makefile | 2 +- 17 files changed, 106 insertions(+), 132 deletions(-) create mode 100644 gossipd/gossip_peerd_wire.csv diff --git a/channeld/Makefile b/channeld/Makefile index 1739a1cf0..d31512712 100644 --- a/channeld/Makefile +++ b/channeld/Makefile @@ -71,7 +71,7 @@ CHANNELD_COMMON_OBJS := \ common/version.o \ common/wire_error.o \ common/wireaddr.o \ - gossipd/gen_gossip_wire.o \ + gossipd/gen_gossip_peerd_wire.o \ hsmd/gen_hsm_wire.o \ lightningd/gossip_msg.o \ wire/fromwire.o \ diff --git a/channeld/channeld.c b/channeld/channeld.c index bf30f45b2..b2d6b5975 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -260,15 +260,15 @@ static void send_channel_update(struct peer *peer, int disable_flag) assert(peer->short_channel_ids[LOCAL].u64); - msg = towire_gossip_local_channel_update(NULL, - &peer->short_channel_ids[LOCAL], - disable_flag - == ROUTING_FLAGS_DISABLED, - peer->cltv_delta, - peer->conf[REMOTE].htlc_minimum_msat, - peer->fee_base, - peer->fee_per_satoshi, - advertised_htlc_max( + msg = towire_gossipd_local_channel_update(NULL, + &peer->short_channel_ids[LOCAL], + disable_flag + == ROUTING_FLAGS_DISABLED, + peer->cltv_delta, + peer->conf[REMOTE].htlc_minimum_msat, + peer->fee_base, + peer->fee_per_satoshi, + advertised_htlc_max( peer->channel->funding_msat, &peer->conf[LOCAL], &peer->conf[REMOTE])); @@ -290,10 +290,10 @@ static void make_channel_local_active(struct peer *peer) u8 *msg; /* Tell gossipd about local channel. */ - msg = towire_gossip_local_add_channel(NULL, - &peer->short_channel_ids[LOCAL], - &peer->node_ids[REMOTE], - peer->channel->funding_msat / 1000); + msg = towire_gossipd_local_add_channel(NULL, + &peer->short_channel_ids[LOCAL], + &peer->node_ids[REMOTE], + peer->channel->funding_msat / 1000); wire_sync_write(GOSSIP_FD, take(msg)); /* 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, struct peer *peer, const u8 *msg, - enum gossip_wire_type replytype) + enum gossip_peerd_wire_type replytype) { return wait_sync_reply(ctx, msg, replytype, GOSSIP_FD, peer->from_gossipd, "gossipd"); @@ -753,10 +753,10 @@ static u8 *foreign_channel_update(const tal_t *ctx, { 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), - WIRE_GOSSIP_GET_UPDATE_REPLY); - if (!fromwire_gossip_get_update_reply(ctx, msg, &update)) + WIRE_GOSSIPD_GET_UPDATE_REPLY); + if (!fromwire_gossipd_get_update_reply(ctx, msg, &update)) status_failed(STATUS_FAIL_GOSSIP_IO, "Invalid update reply"); diff --git a/closingd/Makefile b/closingd/Makefile index d3a0ab666..982c0fef7 100644 --- a/closingd/Makefile +++ b/closingd/Makefile @@ -71,9 +71,8 @@ CLOSINGD_COMMON_OBJS := \ common/version.o \ common/wire_error.o \ common/wireaddr.o \ - gossipd/gen_gossip_wire.o \ - hsmd/gen_hsm_wire.o \ - lightningd/gossip_msg.o + gossipd/gen_gossip_peerd_wire.o \ + hsmd/gen_hsm_wire.o closingd/gen_closing_wire.h: $(WIRE_GEN) closingd/closing_wire.csv $(WIRE_GEN) --header $@ closing_wire_type < closingd/closing_wire.csv > $@ diff --git a/common/read_peer_msg.c b/common/read_peer_msg.c index 667a047c9..77b06abc0 100644 --- a/common/read_peer_msg.c +++ b/common/read_peer_msg.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include @@ -84,7 +84,7 @@ void handle_gossip_msg(int peer_fd, struct crypto_state *cs, const u8 *msg TAKES { 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", tal_hex(msg, msg)); peer_failed_connection_lost(); diff --git a/gossipd/Makefile b/gossipd/Makefile index 2855eb0b2..58c7fd8a8 100644 --- a/gossipd/Makefile +++ b/gossipd/Makefile @@ -6,13 +6,14 @@ gossipd-wrongdir: 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_SRC := gossipd/gen_gossip_wire.c LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o) # gossipd needs these: LIGHTNINGD_GOSSIP_HEADERS := gossipd/gen_gossip_wire.h \ + gossipd/gen_gossip_peerd_wire.h \ gossipd/gen_gossip_store.h \ gossipd/gossip_store.h \ gossipd/routing.h \ @@ -23,7 +24,7 @@ LIGHTNINGD_GOSSIP_OBJS := $(LIGHTNINGD_GOSSIP_SRC:.c=.o) # Make sure these depend on everything. ALL_OBJS += $(LIGHTNINGD_GOSSIP_OBJS) 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 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 $(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 $(WIRE_GEN) --header $@ gossip_store_type < gossipd/gossip_store.csv > $@ diff --git a/gossipd/gossip_constants.h b/gossipd/gossip_constants.h index 77a3de5bd..29a87aa5b 100644 --- a/gossipd/gossip_constants.h +++ b/gossipd/gossip_constants.h @@ -40,4 +40,8 @@ */ #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 */ diff --git a/gossipd/gossip_peerd_wire.csv b/gossipd/gossip_peerd_wire.csv new file mode 100644 index 000000000..d4460be7b --- /dev/null +++ b/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 diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c index 2e070e69f..eba7fbcc3 100644 --- a/gossipd/gossip_store.c +++ b/gossipd/gossip_store.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -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); else if(t == WIRE_NODE_ANNOUNCEMENT) 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); else if(t == WIRE_GOSSIP_STORE_CHANNEL_DELETE) msg = gossip_msg; diff --git a/gossipd/gossip_wire.csv b/gossipd/gossip_wire.csv index 15c4ac0a2..32a422d4c 100644 --- a/gossipd/gossip_wire.csv +++ b/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,,peer_id,?struct pubkey -# Channel daemon can ask for updates for a specific channel, for sending -# 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 - +# gossipd->master: we're closing this channel. gossip_local_channel_close,3027 gossip_local_channel_close,,short_channel_id,struct short_channel_id diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 56a60b56e..21672dd55 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -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) { - const u8 *send = towire_gossip_send_gossip(NULL, msg); + const u8 *send = towire_gossipd_send_gossip(NULL, msg); if (taken(msg)) tal_free(msg); 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; 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", type_to_string(tmpctx, struct pubkey, &peer->id), tal_hex(tmpctx, msg)); @@ -1086,7 +1087,7 @@ out: type_to_string(tmpctx, struct short_channel_id, &scid), 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)); return true; } @@ -1119,14 +1120,14 @@ static bool handle_local_channel_update(struct peer *peer, const u8 *msg) u32 fee_proportional_millionths; int direction; - if (!fromwire_gossip_local_channel_update(msg, - &scid, - &disable, - &cltv_expiry_delta, - &htlc_minimum_msat, - &fee_base_msat, - &fee_proportional_millionths, - &htlc_maximum_msat)) { + if (!fromwire_gossipd_local_channel_update(msg, + &scid, + &disable, + &cltv_expiry_delta, + &htlc_minimum_msat, + &fee_base_msat, + &fee_proportional_millionths, + &htlc_maximum_msat)) { status_broken("peer %s bad local_channel_update %s", type_to_string(tmpctx, struct pubkey, &peer->id), 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. */ - switch ((enum gossip_wire_type)fromwire_peektype(msg)) { - case WIRE_GOSSIP_GET_UPDATE: + switch ((enum gossip_peerd_wire_type)fromwire_peektype(msg)) { + case WIRE_GOSSIPD_GET_UPDATE: ok = handle_get_update(peer, msg); goto handled_cmd; - case WIRE_GOSSIP_LOCAL_ADD_CHANNEL: + case WIRE_GOSSIPD_LOCAL_ADD_CHANNEL: ok = handle_local_add_channel(peer->daemon->rstate, msg); if (ok) gossip_store_add(peer->daemon->rstate->store, msg); goto handled_cmd; - case WIRE_GOSSIP_LOCAL_CHANNEL_UPDATE: + case WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE: ok = handle_local_channel_update(peer, msg); goto handled_cmd; - case WIRE_GOSSIPCTL_INIT: - case WIRE_GOSSIP_GETNODES_REQUEST: - 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: + case WIRE_GOSSIPD_GET_UPDATE_REPLY: + case WIRE_GOSSIPD_SEND_GOSSIP: 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), - gossip_wire_type_name(fromwire_peektype(msg))); + fromwire_peektype(msg), + gossip_peerd_wire_type_name(fromwire_peektype(msg))); return io_close(conn); 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_GET_CHANNEL_PEER_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: break; } diff --git a/gossipd/routing.c b/gossipd/routing.c index 6d6da3adc..101bbc9d4 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -1712,8 +1713,8 @@ bool handle_local_add_channel(struct routing_state *rstate, const u8 *msg) struct pubkey remote_node_id; u64 satoshis; - if (!fromwire_gossip_local_add_channel(msg, &scid, &remote_node_id, - &satoshis)) { + if (!fromwire_gossipd_local_add_channel(msg, &scid, &remote_node_id, + &satoshis)) { status_broken("Unable to parse local_add_channel message: %s", tal_hex(msg, msg)); return false; diff --git a/gossipd/routing.h b/gossipd/routing.h index b9ad9e20d..cd44591b1 100644 --- a/gossipd/routing.h +++ b/gossipd/routing.h @@ -285,10 +285,6 @@ void mark_channel_unroutable(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 * diff --git a/gossipd/test/run-bench-find_route.c b/gossipd/test/run-bench-find_route.c index 28a2b7556..eb2ea5f6f 100644 --- a/gossipd/test/run-bench-find_route.c +++ b/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 */ 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(); } -/* Generated stub for fromwire_gossip_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) -{ fprintf(stderr, "fromwire_gossip_local_add_channel called!\n"); abort(); } +/* Generated stub for fromwire_gossipd_local_add_channel */ +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_gossipd_local_add_channel called!\n"); abort(); } /* 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) { fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); } diff --git a/gossipd/test/run-find_route-specific.c b/gossipd/test/run-find_route-specific.c index c2841632a..10b68e1f0 100644 --- a/gossipd/test/run-find_route-specific.c +++ b/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 */ 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(); } -/* Generated stub for fromwire_gossip_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) -{ fprintf(stderr, "fromwire_gossip_local_add_channel called!\n"); abort(); } +/* Generated stub for fromwire_gossipd_local_add_channel */ +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_gossipd_local_add_channel called!\n"); abort(); } /* 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) { fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); } diff --git a/gossipd/test/run-find_route.c b/gossipd/test/run-find_route.c index 61b4ad807..1c178ee82 100644 --- a/gossipd/test/run-find_route.c +++ b/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 */ 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(); } -/* Generated stub for fromwire_gossip_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) -{ fprintf(stderr, "fromwire_gossip_local_add_channel called!\n"); abort(); } +/* Generated stub for fromwire_gossipd_local_add_channel */ +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_gossipd_local_add_channel called!\n"); abort(); } /* 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) { fprintf(stderr, "fromwire_gossip_store_channel_announcement called!\n"); abort(); } diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 8f0c252bd..82c07e6d3 100644 --- a/lightningd/gossip_control.c +++ b/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_PING: 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_OUTPOINT_SPENT: 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_DEV_SET_MAX_SCIDS_ENCODE_SIZE: case WIRE_GOSSIP_DEV_SUPPRESS: + case WIRE_GOSSIP_LOCAL_CHANNEL_CLOSE: /* This is a reply, so never gets through to here. */ - case WIRE_GOSSIP_GET_UPDATE_REPLY: case WIRE_GOSSIP_GETNODES_REPLY: case WIRE_GOSSIP_GETROUTE_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_GET_CHANNEL_PEER_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; case WIRE_GOSSIP_PING_REPLY: diff --git a/openingd/Makefile b/openingd/Makefile index 893efb156..20b69c52f 100644 --- a/openingd/Makefile +++ b/openingd/Makefile @@ -69,7 +69,7 @@ OPENINGD_COMMON_OBJS := \ common/version.o \ common/wire_error.o \ common/wireaddr.o \ - gossipd/gen_gossip_wire.o \ + gossipd/gen_gossip_peerd_wire.o \ hsmd/gen_hsm_wire.o \ lightningd/gossip_msg.o