| 1251 | } |
| 1252 | |
| 1253 | static struct command_result * |
| 1254 | listsendpays_done(struct command *cmd, const char *buf, |
| 1255 | const jsmntok_t *result, struct sha256 *payment_hash) |
| 1256 | { |
| 1257 | size_t i; |
| 1258 | const jsmntok_t *pays_arr_tok, *pays_tok; |
| 1259 | const char *desc; |
| 1260 | pays_arr_tok = json_get_member(buf, result, "payments"); |
| 1261 | assert(pays_arr_tok->type == JSMN_ARRAY); |
| 1262 | |
| 1263 | /* Did we find a matching entry? */ |
| 1264 | desc = NULL; |
| 1265 | json_for_each_arr(i, pays_tok, pays_arr_tok) { |
| 1266 | char *err; |
| 1267 | |
| 1268 | desc = fetch_out_desc_invstr(cmd, buf, pays_tok, &err); |
| 1269 | if (desc || err) { |
| 1270 | if (err) |
| 1271 | plugin_log(cmd->plugin, |
| 1272 | LOG_BROKEN, "%s", err); |
| 1273 | break; |
| 1274 | } |
| 1275 | } |
| 1276 | |
| 1277 | if (desc) { |
| 1278 | db_begin_transaction(db); |
| 1279 | add_payment_hash_desc(db, payment_hash, desc); |
| 1280 | db_commit_transaction(db); |
| 1281 | } else |
| 1282 | plugin_log(cmd->plugin, LOG_DBG, |
| 1283 | "listpays: bolt11/bolt12 not found:" |
| 1284 | "(%.*s)", |
| 1285 | result->end - result->start, buf); |
| 1286 | |
| 1287 | return notification_handled(cmd); |
| 1288 | } |
| 1289 | |
| 1290 | static struct command_result *lookup_invoice_desc(struct command *cmd, |
| 1291 | struct amount_msat credit, |
nothing calls this directly
no test coverage detected