common/onion_decode: put the path_id into onion_payload->payment_secret.

And check it in invoice.c, insead of a hack where we compare against invhash.
Restore checking, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-11-09 13:01:52 +10:30
committed by Christian Decker
parent 595fbd2a19
commit c6f50220e1
3 changed files with 21 additions and 30 deletions

View File

@@ -285,9 +285,14 @@ struct onion_payload *onion_decode(const tal_t *ctx,
goto field_bad;
}
/* Blinded paths have no payment secret or metadata:
* we use the path_id for that. */
p->payment_secret = NULL;
/* We stash path_id (if present and valid!) in payment_secret */
if (tal_bytelen(enc->path_id) == sizeof(*p->payment_secret)) {
p->payment_secret = tal_steal(p,
(struct secret *)enc->path_id);
} else
p->payment_secret = NULL;
/* FIXME: if we supported metadata, it would also be in path_id */
p->payment_metadata = NULL;
return p;
}