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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-11-29 13:47:35 +10:30 committed by Christian Decker
parent 933c1794a1
commit 40516941af
3 changed files with 19 additions and 5 deletions

View file

@ -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)

View file

@ -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,

View file

@ -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));
}
/**