From 3514c8a034271612ca4790b60fa4bfe990db7ff7 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 8 Jan 2021 05:13:47 +1030 Subject: [PATCH] lightning/onion_message: hack to allow x-only guesses for first hop. I've proposed we use x-only pubkeys everywhere, but meanwhile we do this. Signed-off-by: Rusty Russell --- lightningd/onion_message.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lightningd/onion_message.c b/lightningd/onion_message.c index faaadf6eb..3444c00fa 100644 --- a/lightningd/onion_message.c +++ b/lightningd/onion_message.c @@ -405,8 +405,17 @@ static struct command_result *json_send_onion_message(struct command *cmd, /* Sanity check first; gossipd doesn't bother telling us if peer * can't be reached. */ - if (!peer_by_id(cmd->ld, &first_id)) - return command_fail(cmd, LIGHTNINGD, "Unknown first peer"); + if (!peer_by_id(cmd->ld, &first_id)) { + /* Nasty hack: maybe we didn't know y-parity? */ + first_id.k[0] = SECP256K1_TAG_PUBKEY_ODD; + if (!peer_by_id(cmd->ld, &first_id)) + return command_fail(cmd, LIGHTNINGD, + "Unknown first peer"); + /* Fixup first hop parity. */ + if (!pubkey_from_node_id(&hops[0].id, &first_id)) + return command_fail(cmd, LIGHTNINGD, + "Could not convert parity!"); + } /* Create an onion which encodes this. */ populate_tlvs(hops, reply_path);