|
|
@ -1669,6 +1669,9 @@ struct pay_mpp { |
|
|
|
|
|
|
|
/* Timestamp of the first part */ |
|
|
|
u32 timestamp; |
|
|
|
|
|
|
|
/* The destination of the payment, if specified. */ |
|
|
|
struct node_id *destination; |
|
|
|
}; |
|
|
|
|
|
|
|
static const struct sha256 *pay_mpp_key(const struct pay_mpp *pm) |
|
|
@ -1739,6 +1742,9 @@ static void add_new_entry(struct json_stream *ret, |
|
|
|
if (pm->b11) |
|
|
|
json_add_string(ret, "bolt11", pm->b11); |
|
|
|
|
|
|
|
if (pm->destination) |
|
|
|
json_add_node_id(ret, "destination", pm->destination); |
|
|
|
|
|
|
|
json_add_sha256(ret, "payment_hash", pm->payment_hash); |
|
|
|
json_add_string(ret, "status", pm->status); |
|
|
|
json_add_u32(ret, "created_at", pm->timestamp); |
|
|
@ -1785,13 +1791,15 @@ static struct command_result *listsendpays_done(struct command *cmd, |
|
|
|
ret = jsonrpc_stream_success(cmd); |
|
|
|
json_array_start(ret, "pays"); |
|
|
|
json_for_each_arr(i, t, arr) { |
|
|
|
const jsmntok_t *status, *b11tok, *hashtok, *createdtok; |
|
|
|
const jsmntok_t *status, *b11tok, *hashtok, *destinationtok, *createdtok; |
|
|
|
const char *b11 = b11str; |
|
|
|
struct sha256 payment_hash; |
|
|
|
struct node_id destination; |
|
|
|
u32 created_at; |
|
|
|
|
|
|
|
b11tok = json_get_member(buf, t, "bolt11"); |
|
|
|
hashtok = json_get_member(buf, t, "payment_hash"); |
|
|
|
destinationtok = json_get_member(buf, t, "destination"); |
|
|
|
createdtok = json_get_member(buf, t, "created_at"); |
|
|
|
assert(hashtok != NULL); |
|
|
|
assert(createdtok != NULL); |
|
|
@ -1801,11 +1809,15 @@ static struct command_result *listsendpays_done(struct command *cmd, |
|
|
|
if (b11tok) |
|
|
|
b11 = json_strdup(cmd, buf, b11tok); |
|
|
|
|
|
|
|
if (destinationtok) |
|
|
|
json_to_node_id(buf, destinationtok, &destination); |
|
|
|
|
|
|
|
pm = pay_map_get(&pay_map, &payment_hash); |
|
|
|
if (!pm) { |
|
|
|
pm = tal(cmd, struct pay_mpp); |
|
|
|
pm->payment_hash = tal_dup(pm, struct sha256, &payment_hash); |
|
|
|
pm->b11 = tal_steal(pm, b11); |
|
|
|
pm->destination = tal_dup(pm,struct node_id, &destination); |
|
|
|
pm->label = json_get_member(buf, t, "label"); |
|
|
|
pm->preimage = NULL; |
|
|
|
pm->amount_sent = AMOUNT_MSAT(0); |
|
|
@ -1875,6 +1887,7 @@ static struct command_result *json_listpays(struct command *cmd, |
|
|
|
|
|
|
|
if (payment_hash) |
|
|
|
json_add_sha256(req->js, "payment_hash", payment_hash); |
|
|
|
|
|
|
|
return send_outreq(cmd->plugin, req); |
|
|
|
} |
|
|
|
|
|
|
|