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

Function wallet_invoice_request_find

wallet/wallet.c:6216–6252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6214}
6215
6216char *wallet_invoice_request_find(const tal_t *ctx,
6217 struct wallet *w,
6218 const struct sha256 *invreq_id,
6219 const struct json_escape **label,
6220 enum offer_status *status)
6221{
6222 struct db_stmt *stmt;
6223 char *bolt12;
6224
6225 stmt = db_prepare_v2(w->db, SQL("SELECT bolt12, label, status"
6226 " FROM invoicerequests"
6227 " WHERE invreq_id = ?;"));
6228 db_bind_sha256(stmt, invreq_id);
6229 db_query_prepared(stmt);
6230
6231 if (!db_step(stmt)) {
6232 tal_free(stmt);
6233 return NULL;
6234 }
6235
6236 bolt12 = db_col_strdup(ctx, stmt, "bolt12");
6237 if (label) {
6238 if (db_col_is_null(stmt, "label"))
6239 *label = NULL;
6240 else
6241 *label = db_col_json_escape(ctx, stmt, "label");
6242 } else
6243 db_col_ignore(stmt, "label");
6244
6245 if (status)
6246 *status = offer_status_in_db(db_col_int(stmt, "status"));
6247 else
6248 db_col_ignore(stmt, "status");
6249
6250 tal_free(stmt);
6251 return bolt12;
6252}
6253
6254struct db_stmt *wallet_invreq_id_first(struct wallet *w, struct sha256 *invreq_id)
6255{

Callers 3

json_listinvoicerequestsFunction · 0.85

Calls 10

db_bind_sha256Function · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
tal_freeFunction · 0.85
db_col_strdupFunction · 0.85
db_col_is_nullFunction · 0.85
db_col_json_escapeFunction · 0.85
db_col_ignoreFunction · 0.85
offer_status_in_dbFunction · 0.85
db_col_intFunction · 0.85

Tested by

no test coverage detected