| 4894 | } |
| 4895 | |
| 4896 | void wallet_block_add(struct wallet *w, struct block *b) |
| 4897 | { |
| 4898 | struct db_stmt *stmt = |
| 4899 | db_prepare_v2(w->db, SQL("INSERT INTO blocks " |
| 4900 | "(height, hash, prev_hash) " |
| 4901 | "VALUES (?, ?, ?);")); |
| 4902 | db_bind_int(stmt, b->height); |
| 4903 | db_bind_sha256d(stmt, &b->blkid.shad); |
| 4904 | if (b->prev) { |
| 4905 | db_bind_sha256d(stmt, &b->prev->blkid.shad); |
| 4906 | } else { |
| 4907 | db_bind_null(stmt); |
| 4908 | } |
| 4909 | db_exec_prepared_v2(take(stmt)); |
| 4910 | } |
| 4911 | |
| 4912 | void wallet_block_remove(struct wallet *w, struct block *b) |
| 4913 | { |