| 4917 | } |
| 4918 | |
| 4919 | void wallet_block_add(struct wallet *w, struct block *b) |
| 4920 | { |
| 4921 | struct db_stmt *stmt = |
| 4922 | db_prepare_v2(w->db, SQL("INSERT INTO blocks " |
| 4923 | "(height, hash, prev_hash) " |
| 4924 | "VALUES (?, ?, ?);")); |
| 4925 | db_bind_int(stmt, b->height); |
| 4926 | db_bind_sha256d(stmt, &b->blkid.shad); |
| 4927 | if (b->prev) { |
| 4928 | db_bind_sha256d(stmt, &b->prev->blkid.shad); |
| 4929 | } else { |
| 4930 | db_bind_null(stmt); |
| 4931 | } |
| 4932 | db_exec_prepared_v2(take(stmt)); |
| 4933 | } |
| 4934 | |
| 4935 | void wallet_block_remove(struct wallet *w, struct block *b) |
| 4936 | { |