mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
htlc: Keep the parsed TLV payload around with the htlc_in
We want to show the fields in the invoice_payment hook.
This commit is contained in:
parent
edf4b416c2
commit
477f574569
@ -306,6 +306,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
|
||||
/* If they somehow got an invalid onion this far, fail. */
|
||||
if (!cursor)
|
||||
return tal_free(p);
|
||||
p->tlv = NULL;
|
||||
return p;
|
||||
|
||||
case ONION_TLV_PAYLOAD:
|
||||
@ -404,7 +405,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
|
||||
*p->total_msat
|
||||
= amount_msat(tlv->payment_data->total_msat);
|
||||
}
|
||||
tal_free(tlv);
|
||||
p->tlv = tal_steal(p, tlv);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,9 @@ struct onion_payload {
|
||||
/* If blinding is set, blinding_ss is the shared secret.*/
|
||||
struct pubkey *blinding;
|
||||
struct secret blinding_ss;
|
||||
|
||||
/* The raw TLVs contained in the payload. */
|
||||
struct tlv_tlv_payload *tlv;
|
||||
};
|
||||
|
||||
u8 *onion_nonfinal_hop(const tal_t *ctx,
|
||||
|
@ -58,6 +58,9 @@ struct htlc_in {
|
||||
|
||||
/* A simple text annotation shown in `listpeers` */
|
||||
char *status;
|
||||
|
||||
/* The decoded onion payload after hooks processed it. */
|
||||
struct onion_payload *payload;
|
||||
};
|
||||
|
||||
struct htlc_out {
|
||||
|
@ -1077,6 +1077,10 @@ htlc_accepted_hook_final(struct htlc_accepted_hook_payload *request STEALS)
|
||||
|
||||
request->hin->status = tal_free(request->hin->status);
|
||||
|
||||
/* Hand the payload to the htlc_in since we'll want to have that info
|
||||
* handy for the hooks and notifications. */
|
||||
request->hin->payload = tal_steal(request->hin, request->payload);
|
||||
|
||||
/* *Now* we barf if it failed to decode */
|
||||
if (!request->payload) {
|
||||
log_debug(channel->log,
|
||||
|
Loading…
Reference in New Issue
Block a user