From 9e511cbf3e4510a5c913c3490f0c7c8785cebaac Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sat, 8 Jun 2019 10:58:31 +0200 Subject: [PATCH] plugin: Use the json_add_secret wrapper to add the shared_secret This was incorrectly handled before, hence the wrapper which checks correctness of the arguments. Signed-off-by: Christian Decker --- lightningd/peer_htlcs.c | 2 +- wallet/test/run-wallet.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 8545f426d..aaea0484a 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -721,7 +721,7 @@ static void htlc_accepted_hook_serialize(struct htlc_accepted_hook_payload *p, } json_add_hex_talarr(s, "next_onion", p->next_onion); - json_add_hex(s, "shared_secret", &hin->shared_secret, sizeof(hin->shared_secret)); + json_add_secret(s, "shared_secret", hin->shared_secret); json_object_end(s); json_object_start(s, "htlc"); diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index da7d2e056..13fefd28a 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -254,6 +254,11 @@ void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNN void json_add_s32(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED, int32_t value UNNEEDED) { fprintf(stderr, "json_add_s32 called!\n"); abort(); } +/* Generated stub for json_add_secret */ +void json_add_secret(struct json_stream *response UNNEEDED, + const char *fieldname UNNEEDED, + const struct secret *secret UNNEEDED) +{ fprintf(stderr, "json_add_secret called!\n"); abort(); } /* Generated stub for json_add_short_channel_id */ void json_add_short_channel_id(struct json_stream *response UNNEEDED, const char *fieldname UNNEEDED,