| 4857 | } |
| 4858 | |
| 4859 | void wallet_block_add(struct wallet *w, struct block *b) |
| 4860 | { |
| 4861 | struct db_stmt *stmt = |
| 4862 | db_prepare_v2(w->db, SQL("INSERT INTO blocks " |
| 4863 | "(height, hash, prev_hash) " |
| 4864 | "VALUES (?, ?, ?);")); |
| 4865 | db_bind_int(stmt, b->height); |
| 4866 | db_bind_sha256d(stmt, &b->blkid.shad); |
| 4867 | if (b->prev) { |
| 4868 | db_bind_sha256d(stmt, &b->prev->blkid.shad); |
| 4869 | } else { |
| 4870 | db_bind_null(stmt); |
| 4871 | } |
| 4872 | db_exec_prepared_v2(take(stmt)); |
| 4873 | } |
| 4874 | |
| 4875 | void wallet_block_remove(struct wallet *w, struct block *b) |
| 4876 | { |