MCPcopy Create free account
hub / github.com/ElementsProject/lightning / listsendpays_done

Function listsendpays_done

plugins/bkpr/bookkeeper.c:1253–1288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1251}
1252
1253static struct command_result *
1254listsendpays_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
1290static struct command_result *lookup_invoice_desc(struct command *cmd,
1291 struct amount_msat credit,

Callers

nothing calls this directly

Calls 6

fetch_out_desc_invstrFunction · 0.85
add_payment_hash_descFunction · 0.85
notification_handledFunction · 0.85
json_get_memberFunction · 0.50
plugin_logFunction · 0.50
db_commit_transactionFunction · 0.50

Tested by

no test coverage detected