| 509 | } |
| 510 | |
| 511 | static enum invoice_status invoice_get_status(struct invoices *invoices, struct invoice invoice) |
| 512 | { |
| 513 | struct db_stmt *stmt; |
| 514 | enum invoice_status state; |
| 515 | bool res; |
| 516 | |
| 517 | stmt = db_prepare_v2( |
| 518 | invoices->db, SQL("SELECT state FROM invoices WHERE id = ?;")); |
| 519 | db_bind_u64(stmt, 0, invoice.id); |
| 520 | db_query_prepared(stmt); |
| 521 | |
| 522 | res = db_step(stmt); |
| 523 | assert(res); |
| 524 | state = db_col_int(stmt, "state"); |
| 525 | tal_free(stmt); |
| 526 | return state; |
| 527 | } |
| 528 | |
| 529 | /* If there's an associated offer, mark it used. */ |
| 530 | static void maybe_mark_offer_used(struct db *db, struct invoice invoice) |
no test coverage detected