| 1764 | } |
| 1765 | |
| 1766 | void wallet_blocks_heights(struct wallet *w, u32 def, u32 *min, u32 *max) |
| 1767 | { |
| 1768 | assert(min != NULL && max != NULL); |
| 1769 | struct db_stmt *stmt = db_prepare_v2(w->db, SQL("SELECT MIN(height), MAX(height) FROM blocks;")); |
| 1770 | db_query_prepared(stmt); |
| 1771 | *min = def; |
| 1772 | *max = def; |
| 1773 | |
| 1774 | /* If we ever processed a block we'll get the latest block in the chain */ |
| 1775 | if (db_step(stmt)) { |
| 1776 | if (!db_col_is_null(stmt, "MIN(height)")) { |
| 1777 | *min = db_col_int(stmt, "MIN(height)"); |
| 1778 | *max = db_col_int(stmt, "MAX(height)"); |
| 1779 | } else { |
| 1780 | db_col_ignore(stmt, "MAX(height)"); |
| 1781 | } |
| 1782 | } |
| 1783 | tal_free(stmt); |
| 1784 | } |
| 1785 | |
| 1786 | static void wallet_channel_config_insert(struct wallet *w, |
| 1787 | struct channel_config *cc) |
nothing calls this directly
no test coverage detected