Idempotent: outpointfilter_add is a noop if it already exists. */
| 172 | |
| 173 | /* Idempotent: outpointfilter_add is a noop if it already exists. */ |
| 174 | static void refill_outpointfilters(struct wallet *w) |
| 175 | { |
| 176 | struct db_stmt *stmt; |
| 177 | |
| 178 | stmt = db_prepare_v2( |
| 179 | w->db, |
| 180 | SQL("SELECT txid, outnum FROM utxoset WHERE spendheight is NULL")); |
| 181 | db_query_prepared(stmt); |
| 182 | |
| 183 | while (db_step(stmt)) { |
| 184 | struct bitcoin_outpoint outpoint; |
| 185 | db_col_txid(stmt, "txid", &outpoint.txid); |
| 186 | outpoint.n = db_col_int(stmt, "outnum"); |
| 187 | outpointfilter_add(w->utxoset_outpoints, &outpoint); |
| 188 | } |
| 189 | tal_free(stmt); |
| 190 | } |
| 191 | |
| 192 | static void outpointfilters_init(struct wallet *w) |
| 193 | { |
no test coverage detected