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

Function offer_status_update

wallet/wallet.c:6143–6168  ·  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

6141/* If we make an offer inactive, this also expires all invoices
6142 * which we issued for it. */
6143static void offer_status_update(struct db *db,
6144 const struct sha256 *offer_id,
6145 enum offer_status oldstatus,
6146 enum offer_status newstatus)
6147{
6148 struct db_stmt *stmt;
6149
6150 stmt = db_prepare_v2(db, SQL("UPDATE offers"
6151 " SET status=?"
6152 " WHERE offer_id = ?;"));
6153 db_bind_int(stmt, offer_status_in_db(newstatus));
6154 db_bind_sha256(stmt, offer_id);
6155 db_exec_prepared_v2(take(stmt));
6156
6157 if (!offer_status_active(oldstatus)
6158 || offer_status_active(newstatus))
6159 return;
6160
6161 stmt = db_prepare_v2(db, SQL("UPDATE invoices"
6162 " SET state=?"
6163 " WHERE state=? AND local_offer_id = ?;"));
6164 db_bind_int(stmt, invoice_status_in_db(EXPIRED));
6165 db_bind_int(stmt, invoice_status_in_db(UNPAID));
6166 db_bind_sha256(stmt, offer_id);
6167 db_exec_prepared_v2(take(stmt));
6168}
6169
6170enum offer_status wallet_offer_disable(struct wallet *w,
6171 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