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