expose short_channel_id and htlc id to htlc_accepted.

Changelog-Added: Plugins: `htlc_accepted` now exposes the `short_channel_id` for the channel from which that HTLC is coming from and the low-level per-channel HTLC `id`, which are necessary for bridging two different Lightning Networks when MPP is involved.
This commit is contained in:
fiatjaf 2022-06-01 22:36:11 -03:00 committed by Rusty Russell
parent 928a81f24a
commit 1eaec223b7
2 changed files with 6 additions and 0 deletions

View File

@ -1365,6 +1365,8 @@ The payload of the hook call has the following format:
"next_onion": "[1365bytes of serialized onion]"
},
"htlc": {
"short_channel_id": "4x5x6",
"id": 27,
"amount": "43msat",
"cltv_expiry": 500028,
"cltv_expiry_relative": 10,
@ -1393,6 +1395,8 @@ For detailed information about each field please refer to [BOLT 04 of the specif
- `shared_secret` is the shared secret we used to decrypt the incoming
onion. It is shared with the sender that constructed the onion.
- `htlc`:
- `short_channel_id` is the channel this payment is coming from.
- `id` is the low-level sequential HTLC id integer as sent by the channel peer.
- `amount` is the amount that we received with the HTLC. This amount minus
the `forward_amount` is the fee that will stay with us.
- `cltv_expiry` determines when the HTLC reverts back to the

View File

@ -1065,6 +1065,8 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p,
json_object_end(s);
json_object_start(s, "htlc");
json_add_short_channel_id(s, "short_channel_id", hin->key.channel->scid);
json_add_u64(s, "id", hin->key.id);
json_add_amount_msat_only(s, "amount", hin->msat);
json_add_u32(s, "cltv_expiry", expiry);
json_add_s32(s, "cltv_expiry_relative", expiry - blockheight);