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

Function wallet_block_remove

wallet/wallet.c:4935–4952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4933}
4934
4935void wallet_block_remove(struct wallet *w, struct block *b)
4936{
4937 struct db_stmt *stmt =
4938 db_prepare_v2(w->db, SQL("DELETE FROM blocks WHERE hash = ?"));
4939 db_bind_sha256d(stmt, &b->blkid.shad);
4940 db_exec_prepared_v2(take(stmt));
4941
4942 /* Make sure that all descendants of the block are also deleted */
4943 stmt = db_prepare_v2(w->db,
4944 SQL("SELECT * FROM blocks WHERE height >= ?;"));
4945 db_bind_int(stmt, b->height);
4946 db_query_prepared(stmt);
4947 assert(!db_step(stmt));
4948 tal_free(stmt);
4949
4950 /* We might need to watch more now-unspent UTXOs */
4951 refill_outpointfilters(w);
4952}
4953
4954void wallet_blocks_rollback(struct wallet *w, u32 height)
4955{

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