From 993f44f289d5ceca98dd34bcf57be19cba2e5c3e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Jun 2022 19:52:09 +0930 Subject: [PATCH] libplugin: don't be so strict on msat fields. Let the parsing handle if they're the wrong type (soon they'll be u64). Signed-off-by: Rusty Russell --- plugins/libplugin-pay.c | 2 +- plugins/libplugin.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index bd5faa2c0..35fd1e79f 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -916,7 +916,7 @@ static struct payment_result *tal_sendpay_result_from_json(const tal_t *ctx, /* Initial sanity checks, all these fields must exist. */ if (idtok == NULL || idtok->type != JSMN_PRIMITIVE || hashtok == NULL || hashtok->type != JSMN_STRING || - senttok == NULL || senttok->type != JSMN_STRING || + senttok == NULL || statustok == NULL || statustok->type != JSMN_STRING) { return NULL; } diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 2e728f159..86eeb60d8 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -1591,8 +1591,8 @@ static struct listpeers_channel *json_to_listpeers_channel(const tal_t *ctx, ftxidtok == NULL || ftxidtok->type != JSMN_STRING || (scidtok != NULL && scidtok->type != JSMN_STRING) || (dirtok != NULL && dirtok->type != JSMN_PRIMITIVE) || - tmsattok == NULL || tmsattok->type != JSMN_STRING || - smsattok == NULL || smsattok->type != JSMN_STRING) + tmsattok == NULL || + smsattok == NULL) return NULL; chan = tal(ctx, struct listpeers_channel);