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

Function wallet_block_remove

wallet/wallet.c:4912–4929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4910}
4911
4912void wallet_block_remove(struct wallet *w, struct block *b)
4913{
4914 struct db_stmt *stmt =
4915 db_prepare_v2(w->db, SQL("DELETE FROM blocks WHERE hash = ?"));
4916 db_bind_sha256d(stmt, &b->blkid.shad);
4917 db_exec_prepared_v2(take(stmt));
4918
4919 /* Make sure that all descendants of the block are also deleted */
4920 stmt = db_prepare_v2(w->db,
4921 SQL("SELECT * FROM blocks WHERE height >= ?;"));
4922 db_bind_int(stmt, b->height);
4923 db_query_prepared(stmt);
4924 assert(!db_step(stmt));
4925 tal_free(stmt);
4926
4927 /* We might need to watch more now-unspent UTXOs */
4928 refill_outpointfilters(w);
4929}
4930
4931void wallet_blocks_rollback(struct wallet *w, u32 height)
4932{

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