From f6b4dbc65afaad14e6346ca2754622715ca431fe Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2022 19:52:01 +0930 Subject: [PATCH] lightningd: use amount_msat not amount in htlc_accepted_hook. Changelog-Added: Plugins: `htlc_accepted_hook` `amount_msat` field. Changelog-Deprecated: Plugins: `htlc_accepted_hook` `amount` field (use `amount_msat`) Signed-off-by: Rusty Russell --- doc/PLUGINS.md | 2 +- lightningd/peer_htlcs.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/PLUGINS.md b/doc/PLUGINS.md index fdf07e3fe..88a1797bc 100644 --- a/doc/PLUGINS.md +++ b/doc/PLUGINS.md @@ -1379,7 +1379,7 @@ The payload of the hook call has the following format: "htlc": { "short_channel_id": "4x5x6", "id": 27, - "amount": "43msat", + "amount_msat": "43msat", "cltv_expiry": 500028, "cltv_expiry_relative": 10, "payment_hash": "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 04e94dc1f..9abfa345f 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -1071,7 +1071,9 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p, 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); + if (deprecated_apis) + json_add_amount_msat_only(s, "amount", hin->msat); + json_add_amount_msat_only(s, "amount_msat", hin->msat); json_add_u32(s, "cltv_expiry", expiry); json_add_s32(s, "cltv_expiry_relative", expiry - blockheight); json_add_sha256(s, "payment_hash", &hin->payment_hash);