| 189 | } |
| 190 | |
| 191 | static struct command_result *previoussuccess_done(struct command *cmd, |
| 192 | const char *method UNUSED, |
| 193 | const char *buf, |
| 194 | const jsmntok_t *result, |
| 195 | struct payment *payment) |
| 196 | { |
| 197 | const jsmntok_t *arr = json_get_member(buf, result, "payments"); |
| 198 | if (!arr || arr->type != JSMN_ARRAY) { |
| 199 | return payment_fail( |
| 200 | payment, LIGHTNINGD, |
| 201 | "Unexpected non-array result from listsendpays: %.*s", |
| 202 | json_tok_full_len(result), json_tok_full(buf, result)); |
| 203 | } |
| 204 | |
| 205 | struct success_data success; |
| 206 | if (!success_data_from_listsendpays(buf, arr, &success)) { |
| 207 | /* There are no success sendpays. */ |
| 208 | return payment_continue(payment); |
| 209 | } |
| 210 | |
| 211 | payment->payment_info.start_time.ts.tv_sec = success.created_at; |
| 212 | payment->payment_info.start_time.ts.tv_nsec = 0; |
| 213 | payment->total_delivering = success.deliver_msat; |
| 214 | payment->total_sent = success.sent_msat; |
| 215 | payment->next_partid = success.parts + 1; |
| 216 | payment->groupid = success.groupid; |
| 217 | |
| 218 | payment_note(payment, LOG_DBG, |
| 219 | "Payment completed by a previous sendpay."); |
| 220 | return payment_success(payment, &success.preimage); |
| 221 | } |
| 222 | |
| 223 | static struct command_result *previoussuccess_cb(struct payment *payment) |
| 224 | { |
nothing calls this directly
no test coverage detected