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

Function wallet_block_add

wallet/wallet.c:3777–3794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3775}
3776
3777void wallet_block_add(struct wallet *w, struct block *b)
3778{
3779 struct db_stmt *stmt =
3780 db_prepare_v2(w->db, SQL("INSERT INTO blocks "
3781 "(height, hash, prev_hash) "
3782 "VALUES (?, ?, ?);"));
3783 db_bind_int(stmt, 0, b->height);
3784 db_bind_sha256d(stmt, 1, &b->blkid.shad);
3785 if (b->prev) {
3786 db_bind_sha256d(stmt, 2, &b->prev->blkid.shad);
3787 }else {
3788 db_bind_null(stmt, 2);
3789 }
3790 db_exec_prepared_v2(take(stmt));
3791
3792 /* Now cleanup UTXOs that we don't care about anymore */
3793 wallet_utxoset_prune(w, b->height);
3794}
3795
3796void wallet_block_remove(struct wallet *w, struct block *b)
3797{

Callers 2

test_wallet_outputsFunction · 0.85
add_tipFunction · 0.85

Calls 5

db_bind_intFunction · 0.85
db_bind_sha256dFunction · 0.85
db_bind_nullFunction · 0.85
db_exec_prepared_v2Function · 0.85
wallet_utxoset_pruneFunction · 0.85

Tested by 1

test_wallet_outputsFunction · 0.68