| 1172 | } |
| 1173 | |
| 1174 | static struct command_result * |
| 1175 | listsendpays_done(struct command *cmd, |
| 1176 | const char *method, |
| 1177 | const char *buf, |
| 1178 | const jsmntok_t *result, |
| 1179 | struct payment_hash_info *phinfo) |
| 1180 | { |
| 1181 | size_t i; |
| 1182 | const jsmntok_t *pays_arr_tok, *pays_tok; |
| 1183 | const char *desc; |
| 1184 | struct bkpr *bkpr = bkpr_of(cmd->plugin); |
| 1185 | |
| 1186 | pays_arr_tok = json_get_member(buf, result, "payments"); |
| 1187 | assert(pays_arr_tok->type == JSMN_ARRAY); |
| 1188 | |
| 1189 | /* Did we find a matching entry? */ |
| 1190 | desc = NULL; |
| 1191 | json_for_each_arr(i, pays_tok, pays_arr_tok) { |
| 1192 | char *err; |
| 1193 | |
| 1194 | desc = fetch_out_desc_invstr(cmd, buf, pays_tok, &err); |
| 1195 | if (desc || err) { |
| 1196 | if (err) |
| 1197 | plugin_log(cmd->plugin, |
| 1198 | LOG_BROKEN, "%s", err); |
| 1199 | break; |
| 1200 | } |
| 1201 | } |
| 1202 | |
| 1203 | if (desc) { |
| 1204 | add_payment_hash_description(cmd, bkpr, &phinfo->payment_hash, desc); |
| 1205 | } else |
| 1206 | plugin_log(cmd->plugin, LOG_DBG, |
| 1207 | "listpays: bolt11/bolt12 not found:" |
| 1208 | "(%.*s)", |
| 1209 | result->end - result->start, buf + result->start); |
| 1210 | |
| 1211 | return rinfo_one_done(cmd, phinfo->rinfo); |
| 1212 | } |
| 1213 | |
| 1214 | static struct command_result *lookup_invoice_desc(struct command *cmd, |
| 1215 | struct amount_msat credit, |
nothing calls this directly
no test coverage detected