MCPcopy Create free account
hub / github.com/ElementsProject/lightning / wallet_block_remove

Function wallet_block_remove

wallet/wallet.c:4875–4892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4873}
4874
4875void wallet_block_remove(struct wallet *w, struct block *b)
4876{
4877 struct db_stmt *stmt =
4878 db_prepare_v2(w->db, SQL("DELETE FROM blocks WHERE hash = ?"));
4879 db_bind_sha256d(stmt, &b->blkid.shad);
4880 db_exec_prepared_v2(take(stmt));
4881
4882 /* Make sure that all descendants of the block are also deleted */
4883 stmt = db_prepare_v2(w->db,
4884 SQL("SELECT * FROM blocks WHERE height >= ?;"));
4885 db_bind_int(stmt, b->height);
4886 db_query_prepared(stmt);
4887 assert(!db_step(stmt));
4888 tal_free(stmt);
4889
4890 /* We might need to watch more now-unspent UTXOs */
4891 refill_outpointfilters(w);
4892}
4893
4894void wallet_blocks_rollback(struct wallet *w, u32 height)
4895{

Callers 1

remove_tipFunction · 0.85

Calls 7

db_bind_sha256dFunction · 0.85
db_exec_prepared_v2Function · 0.85
db_bind_intFunction · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
tal_freeFunction · 0.85
refill_outpointfiltersFunction · 0.85

Tested by

no test coverage detected