| 3794 | } |
| 3795 | |
| 3796 | void wallet_block_remove(struct wallet *w, struct block *b) |
| 3797 | { |
| 3798 | struct db_stmt *stmt = |
| 3799 | db_prepare_v2(w->db, SQL("DELETE FROM blocks WHERE hash = ?")); |
| 3800 | db_bind_sha256d(stmt, 0, &b->blkid.shad); |
| 3801 | db_exec_prepared_v2(take(stmt)); |
| 3802 | |
| 3803 | /* Make sure that all descendants of the block are also deleted */ |
| 3804 | stmt = db_prepare_v2(w->db, |
| 3805 | SQL("SELECT * FROM blocks WHERE height >= ?;")); |
| 3806 | db_bind_int(stmt, 0, b->height); |
| 3807 | db_query_prepared(stmt); |
| 3808 | assert(!db_step(stmt)); |
| 3809 | tal_free(stmt); |
| 3810 | } |
| 3811 | |
| 3812 | void wallet_blocks_rollback(struct wallet *w, u32 height) |
| 3813 | { |
no test coverage detected