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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-01-08 05:13:47 +10:30
parent 9d57612415
commit 3514c8a034
1 changed files with 11 additions and 2 deletions

View File

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