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

Function offer_status_update

wallet/wallet.c:5039–5064  ·  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

5037/* If we make an offer inactive, this also expires all invoices
5038 * which we issued for it. */
5039static void offer_status_update(struct db *db,
5040 const struct sha256 *offer_id,
5041 enum offer_status oldstatus,
5042 enum offer_status newstatus)
5043{
5044 struct db_stmt *stmt;
5045
5046 stmt = db_prepare_v2(db, SQL("UPDATE offers"
5047 " SET status=?"
5048 " WHERE offer_id = ?;"));
5049 db_bind_int(stmt, 0, offer_status_in_db(newstatus));
5050 db_bind_sha256(stmt, 1, offer_id);
5051 db_exec_prepared_v2(take(stmt));
5052
5053 if (!offer_status_active(oldstatus)
5054 || offer_status_active(newstatus))
5055 return;
5056
5057 stmt = db_prepare_v2(db, SQL("UPDATE invoices"
5058 " SET state=?"
5059 " WHERE state=? AND local_offer_id = ?;"));
5060 db_bind_int(stmt, 0, invoice_status_in_db(EXPIRED));
5061 db_bind_int(stmt, 1, invoice_status_in_db(UNPAID));
5062 db_bind_sha256(stmt, 2, offer_id);
5063 db_exec_prepared_v2(take(stmt));
5064}
5065
5066enum offer_status wallet_offer_disable(struct wallet *w,
5067 const struct sha256 *offer_id,

Callers 2

wallet_offer_disableFunction · 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