mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
hooks: Add the raw payload to the htlc_accepted call
Since we might soon be changing the payload it is a good idea to not just expose the v0 payload, but also the raw payload for the plugin to interpret. This might also include payloads that `lightningd` itself cannot understand, but the plugin might. Signed-off-by: Christian Decker <decker.christian@gmail.com> Suggested-by: Corné Plooy <@bitonic-cjp>
This commit is contained in:
parent
1561ffaea0
commit
adb984dd45
@ -434,6 +434,8 @@ struct route_step *process_onionpacket(
|
||||
deserialize_hop_data(&step->hop_data, paddedheader);
|
||||
|
||||
memcpy(&step->next->mac, step->hop_data.hmac, SECURITY_PARAMETER);
|
||||
step->raw_payload = tal_dup_arr(step, u8, paddedheader + 1,
|
||||
HOP_DATA_SIZE - 1 - HMAC_SIZE, 0);
|
||||
|
||||
memcpy(&step->next->routinginfo, paddedheader + HOP_DATA_SIZE, ROUTING_INFO_SIZE);
|
||||
|
||||
|
@ -77,6 +77,7 @@ struct route_step {
|
||||
enum route_next_case nextcase;
|
||||
struct onionpacket *next;
|
||||
struct hop_data hop_data;
|
||||
u8 *raw_payload;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -718,6 +718,7 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p,
|
||||
s32 expiry = hin->cltv_expiry, blockheight = p->ld->topology->tip->height;
|
||||
json_object_start(s, "onion");
|
||||
|
||||
json_add_hex_talarr (s, "payload", rs->raw_payload);
|
||||
if (rs->hop_data.realm == 0x00) {
|
||||
json_object_start(s, "per_hop_v0");
|
||||
json_add_hex(s, "realm", &rs->hop_data.realm, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user