mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
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>
This commit is contained in:
parent
07b16e37d0
commit
5c60d7ffb2
17 changed files with 106 additions and 132 deletions
|
@ -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 \
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include <common/wire_error.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <gossipd/gen_gossip_wire.h>
|
||||
#include <gossipd/gen_gossip_peerd_wire.h>
|
||||
#include <gossipd/gossip_constants.h>
|
||||
#include <hsmd/gen_hsm_wire.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);
|
||||
|
||||
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");
|
||||
|
||||
|
|
|
@ -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 > $@
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <common/utils.h>
|
||||
#include <common/wire_error.h>
|
||||
#include <errno.h>
|
||||
#include <gossipd/gen_gossip_wire.h>
|
||||
#include <gossipd/gen_gossip_peerd_wire.h>
|
||||
#include <sys/select.h>
|
||||
#include <wire/peer_wire.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;
|
||||
|
||||
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();
|
||||
|
|
|
@ -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 > $@
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
32
gossipd/gossip_peerd_wire.csv
Normal file
32
gossipd/gossip_peerd_wire.csv
Normal file
|
@ -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
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <common/utils.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <gossipd/gen_gossip_peerd_wire.h>
|
||||
#include <gossipd/gen_gossip_store.h>
|
||||
#include <gossipd/gen_gossip_wire.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);
|
||||
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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <gossipd/broadcast.h>
|
||||
#include <gossipd/gen_gossip_peerd_wire.h>
|
||||
#include <gossipd/gen_gossip_wire.h>
|
||||
#include <gossipd/routing.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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <common/type_to_string.h>
|
||||
#include <common/wire_error.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <gossipd/gen_gossip_peerd_wire.h>
|
||||
#include <gossipd/gen_gossip_wire.h>
|
||||
#include <inttypes.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;
|
||||
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;
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue