| 1953 | } |
| 1954 | |
| 1955 | int main(int argc, const char *argv[]) |
| 1956 | { |
| 1957 | common_setup(argv[0]); |
| 1958 | chainparams = chainparams_for_network("bitcoin"); |
| 1959 | |
| 1960 | bool ok = true; |
| 1961 | struct lightningd *ld; |
| 1962 | |
| 1963 | ld = tal(tmpctx, struct lightningd); |
| 1964 | ld->config = test_config; |
| 1965 | ld->hsm_capabilities = NULL; |
| 1966 | ld->developer = true; |
| 1967 | memset(&ld->indexes[WAIT_SUBSYSTEM_HTLCS], 0, |
| 1968 | sizeof(ld->indexes[WAIT_SUBSYSTEM_HTLCS])); |
| 1969 | |
| 1970 | /* Only elements in ld we should access */ |
| 1971 | ld->peers = tal(ld, struct peer_node_id_map); |
| 1972 | peer_node_id_map_init(ld->peers); |
| 1973 | ld->peers_by_dbid = tal(ld, struct peer_dbid_map); |
| 1974 | peer_dbid_map_init(ld->peers_by_dbid); |
| 1975 | ld->rr_counter = 0; |
| 1976 | node_id_from_hexstr("02a1633cafcc01ebfb6d78e39f687a1f0995c62fc95f51ead10a02ee0be551b5dc", 66, &ld->our_nodeid); |
| 1977 | /* Accessed in peer destructor sanity check */ |
| 1978 | ld->htlcs_in = tal(ld, struct htlc_in_map); |
| 1979 | htlc_in_map_init(ld->htlcs_in); |
| 1980 | ld->htlcs_out = tal(ld, struct htlc_out_map); |
| 1981 | htlc_out_map_init(ld->htlcs_out); |
| 1982 | list_head_init(&ld->wait_commands); |
| 1983 | ld->closed_channels = tal(ld, struct closed_channel_map); |
| 1984 | closed_channel_map_init(ld->closed_channels); |
| 1985 | ld->channels_by_dbid = tal(ld, struct channel_dbid_map); |
| 1986 | channel_dbid_map_init(ld->channels_by_dbid); |
| 1987 | |
| 1988 | /* We do a runtime test here, so we still check compile! */ |
| 1989 | if (HAVE_SQLITE3) { |
| 1990 | for (int bip86 = 0; bip86 < 2; bip86++) { |
| 1991 | ok &= test_shachain_crud(ld, tmpctx, bip86); |
| 1992 | ok &= test_channel_crud(ld, tmpctx, bip86); |
| 1993 | ok &= test_channel_inflight_crud(ld, tmpctx, bip86); |
| 1994 | ok &= test_channel_config_crud(ld, tmpctx, bip86); |
| 1995 | ok &= test_channel_inflight_crud(ld, tmpctx, bip86); |
| 1996 | ok &= test_wallet_outputs(ld, tmpctx, bip86); |
| 1997 | ok &= test_htlc_crud(ld, tmpctx, bip86); |
| 1998 | ok &= test_payment_crud(ld, tmpctx, bip86); |
| 1999 | ok &= test_wallet_payment_status_enum(); |
| 2000 | } |
| 2001 | } |
| 2002 | |
| 2003 | /* Do not clean up in the case of an error, we might want to debug the |
| 2004 | * database. */ |
| 2005 | if (ok) { |
| 2006 | common_shutdown(); |
| 2007 | trace_cleanup(); |
| 2008 | } |
| 2009 | return !ok; |
| 2010 | } |
nothing calls this directly
no test coverage detected