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

Function outpointfilters_init

wallet/wallet.c:66–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64#endif /* DB_FATAL */
65
66static void outpointfilters_init(struct wallet *w)
67{
68 struct db_stmt *stmt;
69 struct utxo **utxos = wallet_get_utxos(NULL, w, OUTPUT_STATE_ANY);
70 struct bitcoin_outpoint outpoint;
71
72 w->owned_outpoints = outpointfilter_new(w);
73 for (size_t i = 0; i < tal_count(utxos); i++)
74 outpointfilter_add(w->owned_outpoints, &utxos[i]->outpoint);
75
76 tal_free(utxos);
77
78 w->utxoset_outpoints = outpointfilter_new(w);
79 stmt = db_prepare_v2(
80 w->db,
81 SQL("SELECT txid, outnum FROM utxoset WHERE spendheight is NULL"));
82 db_query_prepared(stmt);
83
84 while (db_step(stmt)) {
85 db_col_txid(stmt, "txid", &outpoint.txid);
86 outpoint.n = db_col_int(stmt, "outnum");
87 outpointfilter_add(w->utxoset_outpoints, &outpoint);
88 }
89 tal_free(stmt);
90}
91
92struct wallet *wallet_new(struct lightningd *ld, struct timers *timers,
93 struct ext_key *bip32_base STEALS)

Callers 1

wallet_newFunction · 0.85

Calls 8

wallet_get_utxosFunction · 0.85
tal_freeFunction · 0.85
db_query_preparedFunction · 0.85
db_stepFunction · 0.85
db_col_txidFunction · 0.85
db_col_intFunction · 0.85
outpointfilter_newFunction · 0.70
outpointfilter_addFunction · 0.70

Tested by

no test coverage detected