diff --git a/lightningd/pay.c b/lightningd/pay.c index 38e325fe5264..dc3c9a6c7be4 100644 --- a/lightningd/pay.c +++ b/lightningd/pay.c @@ -83,8 +83,15 @@ void json_add_payment_fields(struct json_stream *response, if (t->destination != NULL) json_add_node_id(response, "destination", t->destination); - json_add_amount_msat_compat(response, t->msatoshi, - "msatoshi", "amount_msat"); + /* If we have a 0 amount delivered at the remote end we simply don't + * know since the onion was generated externally. */ + if (amount_msat_greater(t->msatoshi, AMOUNT_MSAT(0))) + json_add_amount_msat_compat(response, t->msatoshi, "msatoshi", + "amount_msat"); + else + json_add_null(response, "amount_msat"); + + json_add_amount_msat_compat(response, t->msatoshi_sent, "msatoshi_sent", "amount_sent_msat"); json_add_u64(response, "created_at", t->timestamp);