| 181 | } |
| 182 | |
| 183 | static struct command_result *json_paystatus(struct command *cmd, |
| 184 | const char *buf, |
| 185 | const jsmntok_t *params) |
| 186 | { |
| 187 | const char *invstring; |
| 188 | struct json_stream *ret; |
| 189 | struct payment *p; |
| 190 | |
| 191 | if (!param(cmd, buf, params, |
| 192 | /* FIXME: rename to invstring */ |
| 193 | p_opt("bolt11", param_invstring, &invstring), |
| 194 | NULL)) |
| 195 | return command_param_failed(); |
| 196 | |
| 197 | ret = jsonrpc_stream_success(cmd); |
| 198 | json_array_start(ret, "pay"); |
| 199 | |
| 200 | list_for_each(&payments, p, list) { |
| 201 | assert(p->parent == NULL); |
| 202 | if (invstring && !streq(invstring, p->invstring)) |
| 203 | continue; |
| 204 | |
| 205 | json_object_start(ret, NULL); |
| 206 | if (p->label != NULL) |
| 207 | json_add_string(ret, "label", p->label); |
| 208 | |
| 209 | if (p->invstring) |
| 210 | json_add_invstring(ret, p->invstring); |
| 211 | json_add_amount_msat(ret, "amount_msat", p->our_amount); |
| 212 | |
| 213 | json_add_node_id(ret, "destination", p->pay_destination); |
| 214 | |
| 215 | /* TODO(cdecker) Add label in once we track labels. */ |
| 216 | /* TODO(cdecker) Add routehint_modifications in once we track |
| 217 | * them. */ |
| 218 | /* TODO(cdecker) Add shadow route once we support it. */ |
| 219 | |
| 220 | /* If it's in listpeers right now, this can be 0 */ |
| 221 | json_array_start(ret, "attempts"); |
| 222 | paystatus_add_payment(ret, p); |
| 223 | json_array_end(ret); |
| 224 | json_object_end(ret); |
| 225 | } |
| 226 | json_array_end(ret); |
| 227 | |
| 228 | return command_finished(cmd, ret); |
| 229 | } |
| 230 | |
| 231 | static void memleak_mark_payments(struct plugin *p, struct htable *memtable) |
| 232 | { |
nothing calls this directly
no test coverage detected