| 654 | } |
| 655 | |
| 656 | struct chain_event *find_chain_event_by_id(const tal_t *ctx, |
| 657 | struct db *db, |
| 658 | u64 event_db_id) |
| 659 | { |
| 660 | struct db_stmt *stmt; |
| 661 | struct chain_event *e; |
| 662 | |
| 663 | stmt = db_prepare_v2(db, SQL("SELECT" |
| 664 | " e.id" |
| 665 | ", e.account_id" |
| 666 | ", a.name" |
| 667 | ", e.origin" |
| 668 | ", e.tag" |
| 669 | ", e.credit" |
| 670 | ", e.debit" |
| 671 | ", e.output_value" |
| 672 | ", e.currency" |
| 673 | ", e.timestamp" |
| 674 | ", e.blockheight" |
| 675 | ", e.utxo_txid" |
| 676 | ", e.outnum" |
| 677 | ", e.spending_txid" |
| 678 | ", e.payment_id" |
| 679 | ", e.ignored" |
| 680 | ", e.stealable" |
| 681 | ", e.ev_desc" |
| 682 | " FROM chain_events e" |
| 683 | " LEFT OUTER JOIN accounts a" |
| 684 | " ON e.account_id = a.id" |
| 685 | " WHERE " |
| 686 | " e.id = ?")); |
| 687 | |
| 688 | db_bind_u64(stmt, 0, event_db_id); |
| 689 | db_query_prepared(stmt); |
| 690 | if (db_step(stmt)) |
| 691 | e = stmt2chain_event(ctx, stmt); |
| 692 | else |
| 693 | e = NULL; |
| 694 | |
| 695 | tal_free(stmt); |
| 696 | return e; |
| 697 | } |
| 698 | |
| 699 | static struct chain_event *find_chain_event(const tal_t *ctx, |
| 700 | struct db *db, |
no test coverage detected