MCPcopy Create free account
hub / github.com/ElementsProject/lightning / wallet_blocks_heights

Function wallet_blocks_heights

wallet/wallet.c:1766–1784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1764}
1765
1766void 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
1786static void wallet_channel_config_insert(struct wallet *w,
1787 struct channel_config *cc)

Callers

nothing calls this directly

Calls 6

db_query_preparedFunction · 0.85
db_stepFunction · 0.85
db_col_is_nullFunction · 0.85
db_col_intFunction · 0.85
db_col_ignoreFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected