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

Function wallet_blocks_maxheight

wallet/wallet.c:2547–2563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2545}
2546
2547u32 wallet_blocks_maxheight(struct wallet *w)
2548{
2549 u32 max = 0;
2550 struct db_stmt *stmt = db_prepare_v2(w->db, SQL("SELECT MAX(height) FROM blocks;"));
2551 db_query_prepared(stmt);
2552
2553 /* If we ever processed a block we'll get the latest block in the chain */
2554 if (db_step(stmt)) {
2555 if (!db_col_is_null(stmt, "MAX(height)")) {
2556 max = db_col_int(stmt, "MAX(height)");
2557 } else {
2558 db_col_ignore(stmt, "MAX(height)");
2559 }
2560 }
2561 tal_free(stmt);
2562 return max;
2563}
2564
2565u32 wallet_blocks_contig_minheight(struct wallet *w)
2566{

Callers 1

setup_topologyFunction · 0.85

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