diff --git a/lightningd/pay.c b/lightningd/pay.c index 515230f0d..3af9afd99 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -129,9 +129,6 @@ void json_add_payment_fields(struct json_stream *response, if (amount_msat_greater(t->msatoshi, AMOUNT_MSAT(0))) json_add_amount_msat_compat(response, t->msatoshi, "msatoshi", "amount_msat"); - else if (deprecated_apis) - json_add_null(response, "amount_msat"); - json_add_amount_msat_compat(response, t->msatoshi_sent, "msatoshi_sent", "amount_sent_msat"); diff --git a/plugins/pay.c b/plugins/pay.c index 2a79f5ee5..c32d332e3 100644 --- a/plugins/pay.c +++ b/plugins/pay.c @@ -1722,8 +1722,7 @@ static void add_amount_sent(struct plugin *p, /* If this is an unannotated partial payment we drop out estimate for * all parts. */ - /* FIXME: with deprecated_apis, amount_msat can be 'null' */ - if (msattok == NULL || !json_to_msat(buf, msattok, &recv)) { + if (msattok == NULL) { mpp->amount = tal_free(mpp->amount); return; } @@ -1734,6 +1733,11 @@ static void add_amount_sent(struct plugin *p, if (mpp->amount == NULL) return; + if (!json_to_msat(buf, msattok, &recv)) + plugin_err(p, "Cannot convert amount_sat %.*s", + json_tok_full_len(msattok), + json_tok_full(buf, msattok)); + if (!amount_msat_add(mpp->amount, *mpp->amount, recv)) plugin_log(p, LOG_BROKEN, "Cannot add amount_msat for %s: %s + %s",