mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
pay: Strip the type prefix from nested channel_updates
This is the counterpart for the previous commit, stripping the type prefix channel_update, to be consistent with lnd and eclair which do it like this.
This commit is contained in:
parent
f449f9d3ef
commit
6bbea741d1
@ -818,7 +818,7 @@ static u8 *foreign_channel_update(const tal_t *ctx,
|
|||||||
struct peer *peer,
|
struct peer *peer,
|
||||||
const struct short_channel_id *scid)
|
const struct short_channel_id *scid)
|
||||||
{
|
{
|
||||||
u8 *msg, *update;
|
u8 *msg, *update, *channel_update;
|
||||||
|
|
||||||
msg = towire_gossip_get_update(NULL, scid);
|
msg = towire_gossip_get_update(NULL, scid);
|
||||||
msg = gossipd_wait_sync_reply(tmpctx, peer, take(msg),
|
msg = gossipd_wait_sync_reply(tmpctx, peer, take(msg),
|
||||||
@ -826,7 +826,20 @@ static u8 *foreign_channel_update(const tal_t *ctx,
|
|||||||
if (!fromwire_gossip_get_update_reply(ctx, msg, &update))
|
if (!fromwire_gossip_get_update_reply(ctx, msg, &update))
|
||||||
status_failed(STATUS_FAIL_GOSSIP_IO,
|
status_failed(STATUS_FAIL_GOSSIP_IO,
|
||||||
"Invalid update reply");
|
"Invalid update reply");
|
||||||
return update;
|
|
||||||
|
/* Strip the type from the channel_update. Due to the specification
|
||||||
|
* being underspecified, some implementations skipped the type
|
||||||
|
* prefix. Since we are in the minority we adapt (See #1730 and
|
||||||
|
* lightningnetwork/lnd#1599 for details). */
|
||||||
|
if (update && fromwire_peektype(update) == WIRE_CHANNEL_UPDATE) {
|
||||||
|
assert(tal_bytelen(update) > 2);
|
||||||
|
channel_update = tal_arr(ctx, u8, 0);
|
||||||
|
towire(&channel_update, update + 2, tal_bytelen(update) - 2);
|
||||||
|
tal_free(update);
|
||||||
|
return channel_update;
|
||||||
|
} else {
|
||||||
|
return update;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 *make_failmsg(const tal_t *ctx,
|
static u8 *make_failmsg(const tal_t *ctx,
|
||||||
|
@ -402,6 +402,7 @@ static void report_routing_failure(struct log *log,
|
|||||||
type_to_string(tmpctx, struct short_channel_id,
|
type_to_string(tmpctx, struct short_channel_id,
|
||||||
&fail->erring_channel),
|
&fail->erring_channel),
|
||||||
tal_hex(tmpctx, fail->channel_update));
|
tal_hex(tmpctx, fail->channel_update));
|
||||||
|
|
||||||
gossip_msg = towire_gossip_routing_failure(tmpctx,
|
gossip_msg = towire_gossip_routing_failure(tmpctx,
|
||||||
&fail->erring_node,
|
&fail->erring_node,
|
||||||
&fail->erring_channel,
|
&fail->erring_channel,
|
||||||
|
Loading…
Reference in New Issue
Block a user