| 204 | } |
| 205 | |
| 206 | struct wallet *wallet_new(struct lightningd *ld, struct timers *timers) |
| 207 | { |
| 208 | struct wallet *wallet = tal(ld, struct wallet); |
| 209 | wallet->ld = ld; |
| 210 | wallet->log = new_logger(wallet, ld->log_book, NULL, "wallet"); |
| 211 | wallet->keyscan_gap = 50; |
| 212 | trace_span_start("db_setup", wallet); |
| 213 | wallet->db = db_setup(wallet, ld, ld->bip32_base); |
| 214 | trace_span_end(wallet); |
| 215 | |
| 216 | db_begin_transaction(wallet->db); |
| 217 | |
| 218 | trace_span_start("load_indexes", wallet); |
| 219 | load_indexes(wallet->db, ld->indexes); |
| 220 | trace_span_end(wallet); |
| 221 | |
| 222 | trace_span_start("invoices_new", wallet); |
| 223 | wallet->invoices = invoices_new(wallet, wallet, timers); |
| 224 | trace_span_end(wallet); |
| 225 | |
| 226 | trace_span_start("outpointfilters_init", wallet); |
| 227 | outpointfilters_init(wallet); |
| 228 | trace_span_end(wallet); |
| 229 | |
| 230 | trace_span_start("our_addresses_init", wallet); |
| 231 | our_addresses_init(wallet); |
| 232 | trace_span_end(wallet); |
| 233 | |
| 234 | db_commit_transaction(wallet->db); |
| 235 | return wallet; |
| 236 | } |
| 237 | |
| 238 | /* Get id for move_accounts; create if necessary */ |
| 239 | static u64 move_accounts_id(struct db *db, const char *name, bool create) |
nothing calls this directly
no test coverage detected