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

Function wallet_block_remove

wallet/wallet.c:3796–3810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3794}
3795
3796void wallet_block_remove(struct wallet *w, struct block *b)
3797{
3798 struct db_stmt *stmt =
3799 db_prepare_v2(w->db, SQL("DELETE FROM blocks WHERE hash = ?"));
3800 db_bind_sha256d(stmt, 0, &b->blkid.shad);
3801 db_exec_prepared_v2(take(stmt));
3802
3803 /* Make sure that all descendants of the block are also deleted */
3804 stmt = db_prepare_v2(w->db,
3805 SQL("SELECT * FROM blocks WHERE height >= ?;"));
3806 db_bind_int(stmt, 0, b->height);
3807 db_query_prepared(stmt);
3808 assert(!db_step(stmt));
3809 tal_free(stmt);
3810}
3811
3812void wallet_blocks_rollback(struct wallet *w, u32 height)
3813{

Callers 1

remove_tipFunction · 0.85

Calls 6

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

Tested by

no test coverage detected