If we make an offer inactive, this also expires all invoices * which we issued for it. */
| 6141 | /* If we make an offer inactive, this also expires all invoices |
| 6142 | * which we issued for it. */ |
| 6143 | static 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 | |
| 6170 | enum offer_status wallet_offer_disable(struct wallet *w, |
| 6171 | const struct sha256 *offer_id, |
no test coverage detected