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

Function offer_status_update

wallet/wallet.c:6083–6108  ·  view source on GitHub ↗

If we make an offer inactive, this also expires all invoices * which we issued for it. */

Source from the content-addressed store, hash-verified

6081/* If we make an offer inactive, this also expires all invoices
6082 * which we issued for it. */
6083static void offer_status_update(struct db *db,
6084 const struct sha256 *offer_id,
6085 enum offer_status oldstatus,
6086 enum offer_status newstatus)
6087{
6088 struct db_stmt *stmt;
6089
6090 stmt = db_prepare_v2(db, SQL("UPDATE offers"
6091 " SET status=?"
6092 " WHERE offer_id = ?;"));
6093 db_bind_int(stmt, offer_status_in_db(newstatus));
6094 db_bind_sha256(stmt, offer_id);
6095 db_exec_prepared_v2(take(stmt));
6096
6097 if (!offer_status_active(oldstatus)
6098 || offer_status_active(newstatus))
6099 return;
6100
6101 stmt = db_prepare_v2(db, SQL("UPDATE invoices"
6102 " SET state=?"
6103 " WHERE state=? AND local_offer_id = ?;"));
6104 db_bind_int(stmt, invoice_status_in_db(EXPIRED));
6105 db_bind_int(stmt, invoice_status_in_db(UNPAID));
6106 db_bind_sha256(stmt, offer_id);
6107 db_exec_prepared_v2(take(stmt));
6108}
6109
6110enum offer_status wallet_offer_disable(struct wallet *w,
6111 const struct sha256 *offer_id,

Callers 3

wallet_offer_disableFunction · 0.85
wallet_offer_enableFunction · 0.85
wallet_offer_mark_usedFunction · 0.85

Calls 6

db_bind_intFunction · 0.85
offer_status_in_dbFunction · 0.85
db_bind_sha256Function · 0.85
db_exec_prepared_v2Function · 0.85
offer_status_activeFunction · 0.85
invoice_status_in_dbFunction · 0.85

Tested by

no test coverage detected