| 4873 | } |
| 4874 | |
| 4875 | void wallet_block_remove(struct wallet *w, struct block *b) |
| 4876 | { |
| 4877 | struct db_stmt *stmt = |
| 4878 | db_prepare_v2(w->db, SQL("DELETE FROM blocks WHERE hash = ?")); |
| 4879 | db_bind_sha256d(stmt, &b->blkid.shad); |
| 4880 | db_exec_prepared_v2(take(stmt)); |
| 4881 | |
| 4882 | /* Make sure that all descendants of the block are also deleted */ |
| 4883 | stmt = db_prepare_v2(w->db, |
| 4884 | SQL("SELECT * FROM blocks WHERE height >= ?;")); |
| 4885 | db_bind_int(stmt, b->height); |
| 4886 | db_query_prepared(stmt); |
| 4887 | assert(!db_step(stmt)); |
| 4888 | tal_free(stmt); |
| 4889 | |
| 4890 | /* We might need to watch more now-unspent UTXOs */ |
| 4891 | refill_outpointfilters(w); |
| 4892 | } |
| 4893 | |
| 4894 | void wallet_blocks_rollback(struct wallet *w, u32 height) |
| 4895 | { |
no test coverage detected