| 961 | } |
| 962 | |
| 963 | static struct wallet *create_test_wallet(struct lightningd *ld, const tal_t *ctx) |
| 964 | { |
| 965 | char *dsn, *filename; |
| 966 | int fd = tmpdir_mkstemp(ctx, "ldb-XXXXXX", &filename); |
| 967 | struct wallet *w = tal(ctx, struct wallet); |
| 968 | static unsigned char badseed[BIP32_ENTROPY_LEN_128]; |
| 969 | const struct ext_key *bip32_base = NULL; |
| 970 | CHECK_MSG(fd != -1, "Unable to generate temp filename"); |
| 971 | close(fd); |
| 972 | |
| 973 | dsn = tal_fmt(NULL, "sqlite3://%s", filename); |
| 974 | w->db = db_open(w, dsn); |
| 975 | w->db->report_changes_fn = NULL; |
| 976 | tal_free(dsn); |
| 977 | tal_add_destructor2(w, cleanup_test_wallet, filename); |
| 978 | |
| 979 | list_head_init(&w->unstored_payments); |
| 980 | w->ld = ld; |
| 981 | ld->wallet = w; |
| 982 | |
| 983 | w->bip32_base = tal(w, struct ext_key); |
| 984 | CHECK(bip32_key_from_seed(badseed, sizeof(badseed), |
| 985 | BIP32_VER_TEST_PRIVATE, 0, |
| 986 | w->bip32_base) == WALLY_OK); |
| 987 | |
| 988 | CHECK_MSG(w->db, "Failed opening the db"); |
| 989 | w->db->data_version = 0; |
| 990 | db_begin_transaction(w->db); |
| 991 | db_migrate(ld, w->db, bip32_base); |
| 992 | db_commit_transaction(w->db); |
| 993 | CHECK_MSG(!wallet_err, wallet_err); |
| 994 | w->max_channel_dbid = 0; |
| 995 | |
| 996 | return w; |
| 997 | } |
| 998 | |
| 999 | static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx) |
| 1000 | { |
no test coverage detected