Browse Source

channeld: fill in channel_update field in errors by asking gossipd.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
40516941af
  1. 7
      channeld/Makefile
  2. 15
      channeld/channel.c
  3. 2
      gossipd/gossip.c

7
channeld/Makefile

@ -58,7 +58,12 @@ CHANNELD_COMMON_OBJS := \
common/timeout.o \
common/type_to_string.o \
common/utils.o \
common/version.o
common/version.o \
common/wireaddr.o \
gossipd/gen_gossip_wire.o \
lightningd/gossip_msg.o \
wire/fromwire.o \
wire/towire.o
# Control daemon uses this:
LIGHTNINGD_CHANNEL_CONTROL_HEADERS := $(LIGHTNINGD_CHANNEL_HEADERS_GEN)

15
channeld/channel.c

@ -621,7 +621,7 @@ static u8 *master_wait_sync_reply(const tal_t *ctx,
MASTER_FD, &peer->from_master, "master");
}
static UNNEEDED 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,
enum gossip_wire_type replytype)
{
@ -1954,8 +1954,17 @@ static u8 *foreign_channel_update(const tal_t *ctx,
struct peer *peer,
const struct short_channel_id *scid)
{
/* FIXME! */
return NULL;
tal_t *tmpctx = tal_tmpctx(ctx);
u8 *msg, *update;
msg = towire_gossip_get_update(tmpctx, scid);
msg = gossipd_wait_sync_reply(tmpctx, peer, take(msg),
WIRE_GOSSIP_GET_UPDATE_REPLY);
if (!fromwire_gossip_get_update_reply(ctx, msg, NULL, &update))
status_failed(STATUS_FAIL_GOSSIP_IO,
"Invalid update reply");
tal_free(tmpctx);
return update;
}
static u8 *make_failmsg(const tal_t *ctx,

2
gossipd/gossip.c

@ -641,7 +641,7 @@ static void handle_get_update(struct peer *peer, const u8 *msg)
reply:
msg = towire_gossip_get_update_reply(msg, update);
msg_enqueue(&peer->peer_out, take(msg));
daemon_conn_send(&peer->owner_conn, take(msg));
}
/**

Loading…
Cancel
Save