trace: Instrument the wallet startup functions

This commit is contained in:
Christian Decker 2023-07-27 14:43:56 +09:30 committed by Rusty Russell
parent 7743062928
commit 3da974ca19
4 changed files with 23 additions and 1 deletions

View File

@ -21,7 +21,7 @@ WALLET_TEST_COMMON_OBJS := \
common/node_id.o \
common/onionreply.o \
common/key_derive.o \
common/psbt_keypath.o \
common/psbt_keypath.o \
common/pseudorand.o \
common/setup.o \
common/timeout.o \

View File

@ -244,6 +244,12 @@ u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx UNNEEDED, u64 channel_i
/* Generated stub for towire_temporary_node_failure */
u8 *towire_temporary_node_failure(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "towire_temporary_node_failure called!\n"); abort(); }
/* Generated stub for trace_span_end */
void trace_span_end(const void *key UNNEEDED)
{ fprintf(stderr, "trace_span_end called!\n"); abort(); }
/* Generated stub for trace_span_start */
void trace_span_start(const char *name UNNEEDED, const void *key UNNEEDED)
{ fprintf(stderr, "trace_span_start called!\n"); abort(); }
/* Generated stub for txfilter_add_scriptpubkey */
void txfilter_add_scriptpubkey(struct txfilter *filter UNNEEDED, const u8 *script TAKES UNNEEDED)
{ fprintf(stderr, "txfilter_add_scriptpubkey called!\n"); abort(); }

View File

@ -856,6 +856,12 @@ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED,
const struct channel_id *channel UNNEEDED,
const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); }
/* Generated stub for trace_span_end */
void trace_span_end(const void *key UNNEEDED)
{ fprintf(stderr, "trace_span_end called!\n"); abort(); }
/* Generated stub for trace_span_start */
void trace_span_start(const char *name UNNEEDED, const void *key UNNEEDED)
{ fprintf(stderr, "trace_span_start called!\n"); abort(); }
/* Generated stub for try_reconnect */
void try_reconnect(const tal_t *ctx UNNEEDED,
struct peer *peer UNNEEDED,

View File

@ -7,6 +7,7 @@
#include <common/blockheight_states.h>
#include <common/fee_states.h>
#include <common/onionreply.h>
#include <common/trace.h>
#include <common/type_to_string.h>
#include <db/bindings.h>
#include <db/common.h>
@ -110,12 +111,21 @@ struct wallet *wallet_new(struct lightningd *ld, struct timers *timers)
wallet->log = new_logger(wallet, ld->log_book, NULL, "wallet");
wallet->keyscan_gap = 50;
list_head_init(&wallet->unstored_payments);
trace_span_start("db_setup", wallet);
wallet->db = db_setup(wallet, ld, ld->bip32_base);
trace_span_end(wallet);
db_begin_transaction(wallet->db);
trace_span_start("invoices_new", wallet);
wallet->invoices = invoices_new(wallet, wallet, timers);
trace_span_end(wallet);
trace_span_start("outpointfilters_init", wallet);
outpointfilters_init(wallet);
load_indexes(wallet->db, ld->indexes);
trace_span_end(wallet);
db_commit_transaction(wallet->db);
return wallet;
}