| 2545 | } |
| 2546 | |
| 2547 | u32 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 | |
| 2565 | u32 wallet_blocks_contig_minheight(struct wallet *w) |
| 2566 | { |
no test coverage detected