mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
unittest: use common_setup / common_shutdown almost everywhere.
Avoids much cut & paste. Some tests don't need any of it, but most want at least some of this infrastructure. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
39f4ca98b5
commit
ca2bd98082
@ -2,6 +2,7 @@
|
||||
#include <bitcoin/privkey.c>
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/time/time.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -106,17 +107,18 @@ static bool secret_time_test(struct timerel (*test)(struct secret *s1,
|
||||
|
||||
#define ITERATIONS 1000
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *v;
|
||||
int const_success, nonconst_success = ITERATIONS, i;
|
||||
double load;
|
||||
setup_locale();
|
||||
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* no point running this under valgrind. */
|
||||
v = getenv("VALGRIND");
|
||||
if (v && atoi(v) == 1)
|
||||
exit(0);
|
||||
goto exit;
|
||||
|
||||
s1 = calloc(RUNS, sizeof(*s1));
|
||||
s2 = calloc(RUNS, sizeof(*s2));
|
||||
@ -142,16 +144,20 @@ int main(void)
|
||||
|
||||
/* Now, check loadavg: if we weren't alone, that could explain results */
|
||||
getloadavg(&load, 1);
|
||||
if (load > 1.0)
|
||||
errx(0, "Load %.2f: too high, ignoring", load);
|
||||
|
||||
if (load > 1.0) {
|
||||
warnx("Load %.2f: too high, ignoring", load);
|
||||
} else {
|
||||
if (const_success < ITERATIONS / 2)
|
||||
errx(1, "Only const time %u/%u?", const_success, i);
|
||||
|
||||
if (nonconst_success < ITERATIONS / 2)
|
||||
errx(1, "memcmp seemed const time %u/%u?", nonconst_success, i);
|
||||
errx(1, "memcmp seemed const time %u/%u?",
|
||||
nonconst_success, i);
|
||||
}
|
||||
free(s1);
|
||||
free(s2);
|
||||
|
||||
exit:
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1057,11 +1057,8 @@ int main(int argc, const char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
/* No memory leaks please */
|
||||
take_cleanup();
|
||||
common_shutdown();
|
||||
|
||||
|
||||
/* FIXME: Do BOLT comparison! */
|
||||
return 0;
|
||||
}
|
||||
|
@ -670,8 +670,6 @@ int main(int argc, const char *argv[])
|
||||
txs_must_be_eq(txs, txs2);
|
||||
}
|
||||
|
||||
/* No memory leaks please */
|
||||
take_cleanup();
|
||||
common_shutdown();
|
||||
|
||||
/* FIXME: Do BOLT comparison! */
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "../amount.c"
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/wire.h>
|
||||
@ -82,13 +83,12 @@ void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNE
|
||||
assert((satp)->satoshis == val); \
|
||||
} while (0)
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct amount_msat msat;
|
||||
struct amount_sat sat;
|
||||
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* Grossly malformed */
|
||||
FAIL_MSAT(&msat, "x");
|
||||
@ -233,5 +233,5 @@ int main(void)
|
||||
assert(sat.satoshis == i);
|
||||
}
|
||||
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/json.c>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
@ -336,8 +337,7 @@ int main(int argc, char *argv[])
|
||||
char **lines, *json = NULL;
|
||||
int test_count = 0;
|
||||
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
lines = tal_strsplit(tmpctx, grab_file(tmpctx, tal_fmt(tmpctx, "%s.c",
|
||||
argv[0])),
|
||||
@ -375,5 +375,5 @@ int main(int argc, char *argv[])
|
||||
tal_append_fmt(&json, "%s", l);
|
||||
}
|
||||
assert(test_count == 2);
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
#include <wally_core.h>
|
||||
|
||||
@ -134,10 +135,8 @@ static void test_b11(const char *b11str,
|
||||
assert(strlen(reproduce) == strlen(b11str));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct bolt11 *b11;
|
||||
struct node_id node;
|
||||
struct amount_msat msatoshi;
|
||||
@ -146,9 +145,7 @@ int main(void)
|
||||
char *fail;
|
||||
struct feature_set *fset;
|
||||
|
||||
wally_init(0);
|
||||
secp256k1_ctx = wally_get_secp_context();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* BOLT #11:
|
||||
*
|
||||
@ -627,8 +624,5 @@ int main(void)
|
||||
assert(streq(fail, "d: invalid utf8"));
|
||||
|
||||
/* FIXME: Test the others! */
|
||||
wally_cleanup(0);
|
||||
tal_free(tmpctx);
|
||||
take_cleanup();
|
||||
return 0;
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/dev_disconnect.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/status.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/peer_wire.h>
|
||||
@ -135,16 +136,14 @@ static void check_result(const u8 *msg, const char *hex)
|
||||
assert(streq(hex, tal_hex(tmpctx, msg)));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct crypto_state cs_out, cs_in;
|
||||
struct secret sk, rk, ck;
|
||||
const void *msg;
|
||||
size_t i;
|
||||
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
msg = tal_dup_arr(tmpctx, char, "hello", 5, 0);
|
||||
|
||||
/* BOLT #8:
|
||||
@ -217,6 +216,6 @@ int main(void)
|
||||
dec = cryptomsg_decrypt_body(enc, &cs_in, enc);
|
||||
assert(memeq(dec, tal_bytelen(dec), msg, tal_bytelen(msg)));
|
||||
}
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <ccan/structeq/structeq.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
#include <wally_core.h>
|
||||
@ -139,15 +140,12 @@ static struct info *new_info(const tal_t *ctx)
|
||||
return info;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
const tal_t *ctx = tal(NULL, char);
|
||||
struct info *baseline, *info;
|
||||
|
||||
wally_init(0);
|
||||
secp256k1_ctx = wally_get_secp_context();
|
||||
common_setup(argv[0]);
|
||||
baseline = new_info(ctx);
|
||||
assert(derive_basepoints(&baseline->seed, &baseline->funding_pubkey,
|
||||
&baseline->basepoints,
|
||||
@ -263,6 +261,6 @@ int main(void)
|
||||
&info->secrets.htlc_basepoint_secret));
|
||||
|
||||
tal_free(ctx);
|
||||
wally_cleanup(0);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <ccan/err/err.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
#include <wally_core.h>
|
||||
@ -248,15 +249,12 @@ static void test_feature_trim(void)
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
u8 *bits;
|
||||
struct feature_set *fset;
|
||||
|
||||
setup_locale();
|
||||
wally_init(0);
|
||||
secp256k1_ctx = wally_get_secp_context();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* Just some bits to set. */
|
||||
fset = feature_set_for_feature(tmpctx,
|
||||
@ -337,8 +335,6 @@ int main(void)
|
||||
test_feature_trim();
|
||||
test_feature_set_sub();
|
||||
|
||||
wally_cleanup(0);
|
||||
tal_free(tmpctx);
|
||||
take_cleanup();
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../gossip_rcvd_filter.c"
|
||||
#include "../pseudorand.c"
|
||||
#include "../../wire/fromwire.c"
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -86,13 +87,13 @@ static u8 *mkgossip(const tal_t *ctx, const char *str)
|
||||
return tal_hexdata(ctx, str, strlen(str));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const tal_t *ctx = tal(NULL, char);
|
||||
struct gossip_rcvd_filter *f = new_gossip_rcvd_filter(ctx);
|
||||
const u8 *msg[3], *badmsg;
|
||||
|
||||
setup_locale();
|
||||
common_setup(argv[0]);
|
||||
|
||||
msg[0] = mkgossip(ctx, "0100231024fcd59aa58ca8e2ed8f71e07843fc576dd6b2872681960ce64f5f3cd3b5386211a103736bf1de2c03a74f5885d50ea30d21a82e4389339ad13149ac7f52942e6ff0778952b7cb001350d1e2edd25cee80c4c64d624a0273be5436923f5524f1f7e4586007203b2f2c47d6863052529321ebb8e0a171ed013c889bbeaa7a462e9826861c608428509804eb4dd5f75dc5e6baa03205933759fd7abcb2e0304b1a895abb7de3d24e92ade99a6a14f51ac9852ef3daf68b8ad40459d8a6124f23e1271537347b6a1bc9bff1f3e6f60e93177b3bf1d53e76771be9c974ba6b1c6d4916762c0867c13f3617e4893f6272c64fa360aaf6c2a94af7739c498bab3600006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000008a8090000510000020cf679b34b5819dfbaf68663bdd636c92117b6c04981940e878818b736c0cdb702809e936f0e82dfce13bcc47c77112db068f569e1db29e7bf98bcdd68b838ee8402590349bcd37d04b81022e52bd65d5119a43e0d7b78f526971ede38d2cd1c0d9e02eec6ac38e4acad847cd42b0946977896527b9e1f7dd59525a1a1344a3cea7fa3");
|
||||
msg[1] = mkgossip(ctx, "0102ccc0a84e4ce09f522f7765db7c30b822ebb346eb17dda92612d03cc8e53ee1454b6c9a918a60ac971e623fd056687f17a01d3c7e805723f7b68be0e8544013546fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000008a80900005100005d06bacc0102009000000000000003e8000003e8000000010000000005e69ec0");
|
||||
@ -192,5 +193,6 @@ int main(void)
|
||||
&& tal_next(f->cur) == NULL));
|
||||
|
||||
tal_free(ctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <assert.h>
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/setup.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for amount_asset_is_main */
|
||||
@ -109,15 +110,13 @@ void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNE
|
||||
{ fprintf(stderr, "towire_u8_array called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct wireaddr addr;
|
||||
char *ip;
|
||||
u16 port;
|
||||
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* Grossly invalid. */
|
||||
assert(!separate_address_and_port(tmpctx, "[", &ip, &port));
|
||||
@ -193,6 +192,6 @@ int main(void)
|
||||
assert(tal_count(wireaddr_from_hostname(tmpctx, "odpzvneidqdf5hdq.onion", 1, NULL, NULL, NULL)) > 0);
|
||||
assert(wireaddr_from_hostname(tmpctx, "aaa.onion", 1, NULL, NULL, NULL) == NULL);
|
||||
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <ccan/mem/mem.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/json.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
@ -287,17 +288,15 @@ static void test_json_bad_utf8(void)
|
||||
assert(json_parse_simple(tmpctx, buf, strlen(buf)));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
test_json_tok_size();
|
||||
test_json_tok_bitcoin_amount();
|
||||
test_json_tok_millionths();
|
||||
test_json_delve();
|
||||
test_json_bad_utf8();
|
||||
assert(!taken_any());
|
||||
take_cleanup();
|
||||
tal_free(tmpctx);
|
||||
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <common/amount.h>
|
||||
#include <common/utils.h>
|
||||
#include <common/json.c>
|
||||
#include <common/setup.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
@ -264,10 +265,9 @@ static void remove_inside_obj(void)
|
||||
"4", "four", NULL);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
sanity();
|
||||
remove_one();
|
||||
@ -278,6 +278,6 @@ int main(void)
|
||||
remove_complex();
|
||||
remove_inside_obj();
|
||||
|
||||
tal_free(tmpctx);
|
||||
printf("run-json_remove ok\n");
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <assert.h>
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/wire.h>
|
||||
@ -118,17 +119,13 @@ static struct secret secret_from_hex(const char *hex)
|
||||
return s;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct privkey privkey;
|
||||
struct secret base_secret, per_commitment_secret;
|
||||
struct pubkey base_point, per_commitment_point, pubkey, pubkey2;
|
||||
|
||||
setup_tmpctx();
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
common_setup(argv[0]);
|
||||
|
||||
base_secret = secret_from_hex("0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f");
|
||||
per_commitment_secret = secret_from_hex("0x1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100");
|
||||
@ -178,8 +175,5 @@ int main(void)
|
||||
pubkey_from_privkey(&privkey, &pubkey2);
|
||||
assert(pubkey_eq(&pubkey, &pubkey2));
|
||||
|
||||
/* No memory leaks please */
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
tal_free(tmpctx);
|
||||
return 0;
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <ccan/io/io.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -215,12 +216,11 @@ static bool test_multi_write(const tal_t *ctx)
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool ok = true;
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
ok &= test_multi_write(tmpctx);
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
return !ok;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <ccan/err/err.h>
|
||||
#include <common/errcode.h>
|
||||
#include <common/json.h>
|
||||
#include <common/setup.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
@ -590,10 +591,9 @@ static void usage(void)
|
||||
cmd->mode = CMD_NORMAL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
cmd = tal(tmpctx, struct command);
|
||||
cmd->mode = CMD_NORMAL;
|
||||
fail_msg = tal_arr(cmd, char, 10000);
|
||||
@ -615,6 +615,6 @@ int main(void)
|
||||
param_tests();
|
||||
usage();
|
||||
|
||||
tal_free(tmpctx);
|
||||
printf("run-params ok\n");
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <assert.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/wire.h>
|
||||
@ -109,13 +110,13 @@ struct objtype {
|
||||
char *c_softref, *c_softref2;
|
||||
};
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const void *ctx = tal(NULL, char);
|
||||
struct objtype *o;
|
||||
char *c;
|
||||
|
||||
setup_locale();
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* Simple test: freeing obj NULLs softref */
|
||||
o = tal(ctx, struct objtype);
|
||||
@ -159,4 +160,5 @@ int main(void)
|
||||
tal_free(o);
|
||||
|
||||
tal_free(ctx);
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -3,11 +3,11 @@
|
||||
#include "../onionreply.c"
|
||||
#include "../sphinx.c"
|
||||
#include <secp256k1.h>
|
||||
#include <ccan/opt/opt.h>
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <string.h>
|
||||
#include <ccan/str/hex/hex.h>
|
||||
#include <common/ecdh.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/sphinx.h>
|
||||
#include <common/utils.h>
|
||||
#include <err.h>
|
||||
@ -208,16 +208,9 @@ static void run_unit_tests(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(
|
||||
SECP256K1_CONTEXT_VERIFY | SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
|
||||
common_setup(argv[0]);
|
||||
run_unit_tests();
|
||||
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
opt_free_table();
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ CONNECTD_TEST_PROGRAMS := $(CONNECTD_TEST_OBJS:.o=)
|
||||
CONNECTD_TEST_COMMON_OBJS := \
|
||||
common/features.o \
|
||||
common/pseudorand.o \
|
||||
common/setup.o \
|
||||
common/type_to_string.o \
|
||||
common/utils.o
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <ccan/io/io.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/memleak.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/status.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
@ -287,8 +288,7 @@ static struct io_plan *success(struct io_conn *conn UNUSED,
|
||||
assert(secret_eq_str(&cs->rk, expect_rk));
|
||||
|
||||
/* No memory leaks please */
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -299,16 +299,11 @@ void ecdh(const struct pubkey *point, struct secret *ss)
|
||||
abort();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct wireaddr_internal dummy;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* BOLT #8:
|
||||
*
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <ccan/io/io.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/memleak.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/status.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
@ -283,9 +284,7 @@ static struct io_plan *success(struct io_conn *conn UNUSED,
|
||||
assert(secret_eq_str(&cs->sk, expect_sk));
|
||||
assert(secret_eq_str(&cs->rk, expect_rk));
|
||||
|
||||
/* No memory leaks please */
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -296,16 +295,11 @@ void ecdh(const struct pubkey *point, struct secret *ss)
|
||||
abort();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct wireaddr_internal dummy;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
|
||||
common_setup(argv[0]);
|
||||
|
||||
/* BOLT #8:
|
||||
*
|
||||
|
@ -38,6 +38,7 @@ DEVTOOLS_COMMON_OBJS := \
|
||||
common/json.o \
|
||||
common/json_helpers.o \
|
||||
common/json_stream.o \
|
||||
common/setup.o \
|
||||
common/type_to_string.o \
|
||||
common/utils.o \
|
||||
common/version.o \
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <common/blinding.h>
|
||||
#include <common/ecdh.h>
|
||||
#include <common/hmac.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/sphinx.h>
|
||||
#include <common/type_to_string.h>
|
||||
#include <common/utils.h>
|
||||
@ -52,10 +53,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
bool first = false;
|
||||
|
||||
setup_locale();
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY |
|
||||
SECP256K1_CONTEXT_SIGN);
|
||||
common_setup(argv[0]);
|
||||
|
||||
opt_set_alloc(opt_allocfn, tal_reallocfn, tal_freefn);
|
||||
opt_register_noarg("--help|-h", opt_usage_and_exit,
|
||||
@ -69,7 +67,6 @@ int main(int argc, char **argv)
|
||||
opt_register_version();
|
||||
|
||||
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||||
setup_tmpctx();
|
||||
|
||||
if (argc < 2)
|
||||
errx(1, "You must specify create or unwrap");
|
||||
@ -315,4 +312,6 @@ int main(int argc, char **argv)
|
||||
printf("Next onion: %s\n", tal_hex(tmpctx, serialize_onionpacket(tmpctx, rs->next)));
|
||||
} else
|
||||
errx(1, "Either create or unwrap!");
|
||||
|
||||
common_shutdown();
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <common/bech32.h>
|
||||
#include <common/bolt11.h>
|
||||
#include <common/features.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/type_to_string.h>
|
||||
#include <common/version.h>
|
||||
#include <inttypes.h>
|
||||
@ -56,8 +57,6 @@ static char *fmt_time(const tal_t *ctx, u64 time)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
const tal_t *ctx = tal(NULL, char);
|
||||
const char *method;
|
||||
struct bolt11 *b11;
|
||||
@ -65,9 +64,7 @@ int main(int argc, char *argv[])
|
||||
size_t i;
|
||||
char *fail, *description = NULL;
|
||||
|
||||
err_set_progname(argv[0]);
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
common_setup(argv[0]);
|
||||
|
||||
opt_set_alloc(opt_allocfn, tal_reallocfn, tal_freefn);
|
||||
opt_register_noarg("--help|-h", opt_usage_and_exit,
|
||||
@ -186,5 +183,6 @@ int main(int argc, char *argv[])
|
||||
printf("signature: %s\n",
|
||||
type_to_string(ctx, secp256k1_ecdsa_signature, &b11->sig));
|
||||
tal_free(ctx);
|
||||
common_shutdown();
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ GOSSIPD_TEST_COMMON_OBJS := \
|
||||
common/json.o \
|
||||
common/json_helpers.o \
|
||||
common/pseudorand.o \
|
||||
common/setup.o \
|
||||
common/type_to_string.o \
|
||||
common/utils.o \
|
||||
wire/peer$(EXP)_wiregen.o \
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <ccan/time/time.h>
|
||||
#include <common/json_stream.h>
|
||||
#include <common/pseudorand.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/status.h>
|
||||
#include <common/type_to_string.h>
|
||||
#include <stdio.h>
|
||||
@ -224,8 +225,6 @@ static void run(const char *name)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct routing_state *rstate;
|
||||
size_t num_nodes = 100, num_runs = 1;
|
||||
struct timemono start, end;
|
||||
@ -236,9 +235,7 @@ int main(int argc, char *argv[])
|
||||
const double riskfactor = 0.01 / BLOCKS_PER_YEAR / 10000;
|
||||
struct siphash_seed base_seed;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
me = nodeid(0);
|
||||
rstate = new_routing_state(tmpctx, &me, NULL, NULL, NULL,
|
||||
@ -302,8 +299,7 @@ int main(int argc, char *argv[])
|
||||
if (route_lengths[i])
|
||||
printf(" Length %zu: %zu\n", i, route_lengths[i]);
|
||||
|
||||
tal_free(tmpctx);
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
common_shutdown();
|
||||
opt_free_table();
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ In particular, we set feature bit 19. The spec says we should set feature bit 1
|
||||
#include "../common/wire_error.c"
|
||||
#include "../routing.c"
|
||||
#include <common/json_stream.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
@ -130,7 +131,7 @@ u8 *towire_gossip_store_channel_amount(const tal_t *ctx UNNEEDED, struct amount_
|
||||
{ fprintf(stderr, "towire_gossip_store_channel_amount called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct bitcoin_blkid chain_hash;
|
||||
u8 *features, *err;
|
||||
@ -141,10 +142,7 @@ int main(void)
|
||||
struct pubkey bitcoin_key_1, bitcoin_key_2;
|
||||
const u8 *cannounce;
|
||||
|
||||
setup_locale();
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
cannounce = tal_hexdata(tmpctx, "010011effc9ed10fceccfae5f9e3fef20d983b06eed030e968fd8d1e6c5905e18f9f2df6a43f00d7c0ddf52e0467ab1e32394051b72ea6343fb008a4117c265f3d7b732bab7df4ee404ac926aef6610f4eb33e31baabfd9afdbf897c8a80057efa1468362b4d2cc0a5482013e1058c8205717f85c3bc82c3ea89f17cfeac21e2cb2ac65b429f79b24fbd51094bee5e080d4c7cfc28a584e279075643054a48b2972f0b72becfd57e03297bf0102b09329982e0ac839dc120959c07456431d3c8fd1430ffe2cc2710e9600e602779c9cf5f91e95874ef4bcf9f0bdda2ce2be97bba562848a2717acdb8dec30bd5073f2f853776cc98f0b6cddc2dcfb57aa69fa7c43400030800006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000009984d00063a00010254ff808f53b2f8c45e74b70430f336c6c76ba2f4af289f48d6086ae6e60462d303baa70886d9200af0ffbd3f9e18d96008331c858456b16e3a9b41e735c6208fef03c8731bbac446b7d11b7f5a1861c7d2c87ccf429780c74463de3428dceeb73ad702b3e55c7a1a6cdf17a83a801f7f8f698e4980323e2584f27a643a1b0519ebf8c7", strlen("010011effc9ed10fceccfae5f9e3fef20d983b06eed030e968fd8d1e6c5905e18f9f2df6a43f00d7c0ddf52e0467ab1e32394051b72ea6343fb008a4117c265f3d7b732bab7df4ee404ac926aef6610f4eb33e31baabfd9afdbf897c8a80057efa1468362b4d2cc0a5482013e1058c8205717f85c3bc82c3ea89f17cfeac21e2cb2ac65b429f79b24fbd51094bee5e080d4c7cfc28a584e279075643054a48b2972f0b72becfd57e03297bf0102b09329982e0ac839dc120959c07456431d3c8fd1430ffe2cc2710e9600e602779c9cf5f91e95874ef4bcf9f0bdda2ce2be97bba562848a2717acdb8dec30bd5073f2f853776cc98f0b6cddc2dcfb57aa69fa7c43400030800006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d619000000000009984d00063a00010254ff808f53b2f8c45e74b70430f336c6c76ba2f4af289f48d6086ae6e60462d303baa70886d9200af0ffbd3f9e18d96008331c858456b16e3a9b41e735c6208fef03c8731bbac446b7d11b7f5a1861c7d2c87ccf429780c74463de3428dceeb73ad702b3e55c7a1a6cdf17a83a801f7f8f698e4980323e2584f27a643a1b0519ebf8c7"));
|
||||
if (!fromwire_channel_announcement(cannounce, cannounce,
|
||||
@ -196,7 +194,6 @@ int main(void)
|
||||
assert(memmem(err, tal_bytelen(err),
|
||||
"Bad node_signature_2", strlen("Bad node_signature_2")));
|
||||
|
||||
tal_free(tmpctx);
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ bool wire_sync_write(int fd UNNEEDED, const void *msg TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "wire_sync_write called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
u8 *update;
|
||||
setup_locale();
|
||||
|
@ -6,6 +6,7 @@
|
||||
* {'channels': [{'active': True, 'short_id': '6990x2x1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, {'active': True, 'short_id': '6989x2x1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6990x2x1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6989x2x1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]}
|
||||
*/
|
||||
#include <common/json_stream.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/status.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -166,10 +167,8 @@ static bool channel_is_between(const struct chan *chan,
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct half_chan *nc;
|
||||
struct routing_state *rstate;
|
||||
struct node_id a, b, c, d;
|
||||
@ -177,9 +176,7 @@ int main(void)
|
||||
struct chan **route;
|
||||
const double riskfactor = 1.0 / BLOCKS_PER_YEAR / 10000;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
node_id_from_hexstr("03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf",
|
||||
strlen("03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf"),
|
||||
@ -281,7 +278,6 @@ int main(void)
|
||||
ROUTING_MAX_HOPS, &fee);
|
||||
assert(!route);
|
||||
|
||||
tal_free(tmpctx);
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../routing.c"
|
||||
#include "../gossip_store.c"
|
||||
#include <common/json_stream.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void status_fmt(enum log_level level UNUSED,
|
||||
@ -214,10 +215,8 @@ static bool channel_is_between(const struct chan *chan,
|
||||
return false;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct routing_state *rstate;
|
||||
struct node_id a, b, c, d;
|
||||
struct privkey tmp;
|
||||
@ -225,9 +224,7 @@ int main(void)
|
||||
struct chan **route;
|
||||
const double riskfactor = 1.0 / BLOCKS_PER_YEAR / 10000;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
memset(&tmp, 'a', sizeof(tmp));
|
||||
node_id_from_privkey(&tmp, &a);
|
||||
@ -301,7 +298,6 @@ int main(void)
|
||||
assert(channel_is_between(route[1], &d, &c));
|
||||
assert(amount_msat_eq(fee, AMOUNT_MSAT(0 + 6)));
|
||||
|
||||
tal_free(tmpctx);
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ static void test_block_range(struct seeker *seeker,
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct seeker *seeker = tal(NULL, struct seeker);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../routing.c"
|
||||
#include "../gossip_store.c"
|
||||
#include <common/json_stream.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void status_fmt(enum log_level level UNUSED,
|
||||
@ -136,18 +137,14 @@ static void node_id_from_privkey(const struct privkey *p, struct node_id *id)
|
||||
/* We create an arrangement of nodes, each node N connected to N+1 and
|
||||
* to node 1. The cost for each N to N+1 route is 1, for N to 1 is
|
||||
* 2^N. That means it's always cheapest to go the longer route */
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct routing_state *rstate;
|
||||
struct node_id ids[NUM_NODES];
|
||||
struct chan **route;
|
||||
struct amount_msat last_fee;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
for (size_t i = 0; i < NUM_NODES; i++) {
|
||||
struct privkey tmp;
|
||||
@ -221,7 +218,6 @@ int main(void)
|
||||
last_fee = fee;
|
||||
}
|
||||
|
||||
tal_free(tmpctx);
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../routing.c"
|
||||
#include "../common/timeout.c"
|
||||
#include <common/json_stream.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
@ -107,15 +108,14 @@ struct gossip_store *gossip_store_new(struct routing_state *rstate UNNEEDED,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct routing_state *rstate;
|
||||
struct timers timers;
|
||||
struct timer *t;
|
||||
struct short_channel_id scid1, scid2;
|
||||
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
timers_init(&timers, time_mono());
|
||||
/* Random uninitalized node_id, we don't reference it. */
|
||||
@ -158,7 +158,7 @@ int main(void)
|
||||
assert(rstate->num_txout_failures == 1);
|
||||
assert(!in_txout_failures(rstate, &scid2));
|
||||
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
timers_cleanup(&timers);
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ LIGHTNINGD_TEST_COMMON_OBJS := \
|
||||
common/random_select.o \
|
||||
common/memleak.o \
|
||||
common/msg_queue.o \
|
||||
common/setup.o \
|
||||
common/utils.o \
|
||||
common/utxo.o \
|
||||
common/type_to_string.o \
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "../routehint.c"
|
||||
#include <ccan/alignof/alignof.h>
|
||||
#include <common/errcode.h>
|
||||
#include <common/setup.h>
|
||||
|
||||
bool deprecated_apis = false;
|
||||
|
||||
@ -768,17 +769,14 @@ STRUCTEQ_DEF(route_info,
|
||||
fee_base_msat,
|
||||
fee_proportional_millionths);
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct lightningd *ld;
|
||||
struct routehint_candidate *candidates;
|
||||
struct route_info **ret;
|
||||
size_t n;
|
||||
|
||||
setup_locale();
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
ld = tal(tmpctx, struct lightningd);
|
||||
|
||||
list_head_init(&ld->peers);
|
||||
@ -856,9 +854,7 @@ int main(void)
|
||||
n, 1000 - n);
|
||||
assert(n > 250 - 50 && n < 250 + 50);
|
||||
|
||||
/* No memory leaks please */
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
|
||||
/* FIXME: Do BOLT comparison! */
|
||||
return 0;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../../common/json_stream.c"
|
||||
#include "../jsonrpc.c"
|
||||
#include "../json.c"
|
||||
#include <common/setup.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for db_begin_transaction_ */
|
||||
@ -295,14 +296,14 @@ static void test_json_stream(void)
|
||||
tal_free(toks);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
common_setup(argv[0]);
|
||||
|
||||
test_json_filter();
|
||||
test_json_escape();
|
||||
test_json_partial();
|
||||
test_json_stream();
|
||||
assert(!taken_any());
|
||||
take_cleanup();
|
||||
|
||||
common_shutdown();
|
||||
}
|
||||
|
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
@ -1690,4 +1690,4 @@ struct db_query db_postgres_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:756457b3587828d8b4226c2787cbadc1605669371ac57bb92c0b21e434bd80e1
|
||||
// SHA256STAMP:a61b8b6ea86287e22c696530a9b5cd35ccef271280b8ac34d2665dc5aff42fce
|
||||
|
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
@ -1690,4 +1690,4 @@ struct db_query db_sqlite3_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:756457b3587828d8b4226c2787cbadc1605669371ac57bb92c0b21e434bd80e1
|
||||
// SHA256STAMP:a61b8b6ea86287e22c696530a9b5cd35ccef271280b8ac34d2665dc5aff42fce
|
||||
|
6
wallet/statements_gettextgen.po
generated
6
wallet/statements_gettextgen.po
generated
@ -1102,15 +1102,15 @@ msgstr ""
|
||||
msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/test/run-db.c:119
|
||||
#: wallet/test/run-db.c:120
|
||||
msgid "SELECT name FROM sqlite_master WHERE type='table';"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/test/run-db.c:124
|
||||
#: wallet/test/run-db.c:125
|
||||
msgid "not a valid SQL statement"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/test/run-wallet.c:1376
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:8fd4a9d444c885db744f98790817b0b580f3e39e36be393e578cc05418d25323
|
||||
# SHA256STAMP:a63bd31a3977b161d8245ffddf5de3a03c972a60436eb8cbc1bb23f0ffb03405
|
||||
|
@ -14,6 +14,7 @@ static void db_log_(struct log *log UNUSED, enum log_level level UNUSED, const s
|
||||
|
||||
#include <common/amount.h>
|
||||
#include <common/memleak.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -162,14 +163,13 @@ static bool test_vars(struct lightningd *ld)
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
setup_tmpctx();
|
||||
|
||||
bool ok = true;
|
||||
/* Dummy for migration hooks */
|
||||
struct lightningd *ld = tal(NULL, struct lightningd);
|
||||
|
||||
common_setup(argv[0]);
|
||||
ld->config = test_config;
|
||||
|
||||
ok &= test_empty_db_migrate(ld);
|
||||
@ -177,6 +177,6 @@ int main(void)
|
||||
ok &= test_primitives();
|
||||
|
||||
tal_free(ld);
|
||||
tal_free(tmpctx);
|
||||
common_shutdown();
|
||||
return !ok;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ ALL_C_SOURCES += $(WIRE_TEST_SRC)
|
||||
ALL_TEST_PROGRAMS += $(WIRE_TEST_PROGRAMS)
|
||||
|
||||
WIRE_TEST_COMMON_OBJS := \
|
||||
common/setup.o \
|
||||
common/utils.o
|
||||
|
||||
update-mocks: $(WIRE_TEST_SRC:%=update-mocks/%)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <common/amount.h>
|
||||
#include <common/bigsize.h>
|
||||
#include <bitcoin/chainparams.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/sphinx.h>
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
@ -955,10 +956,8 @@ static bool node_announcement_eq(const struct msg_node_announcement *a,
|
||||
#define test_corruption_tlv(a, b, type) \
|
||||
test_bitflip_and_short(a, b, type, false)
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
|
||||
struct msg_channel_announcement ca, *ca2;
|
||||
struct msg_funding_locked fl, *fl2;
|
||||
struct msg_announcement_signatures as, *as2;
|
||||
@ -984,8 +983,7 @@ int main(void)
|
||||
u8 *msg;
|
||||
const struct chainparams **chains;
|
||||
|
||||
secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY
|
||||
| SECP256K1_CONTEXT_SIGN);
|
||||
common_setup(argv[0]);
|
||||
|
||||
memset(&ca, 2, sizeof(ca));
|
||||
set_node_id(&ca.node_id_1);
|
||||
@ -1170,8 +1168,7 @@ int main(void)
|
||||
assert(node_announcement_eq(&na, na2));
|
||||
test_corruption(&na, na2, node_announcement);
|
||||
|
||||
/* No memory leaks please */
|
||||
secp256k1_context_destroy(secp256k1_ctx);
|
||||
tal_free(ctx);
|
||||
common_shutdown();
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ static const char *reason;
|
||||
#include <common/amount.c>
|
||||
#include <common/bigsize.c>
|
||||
#include <common/node_id.c>
|
||||
#include <common/setup.h>
|
||||
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
#include <wire/peer_exp_wiregen.c>
|
||||
@ -445,13 +446,9 @@ static bool ignored_fields(const struct tlv_n1 *tlv_n1)
|
||||
&& tlv_n1->tlv4 == NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setup_locale();
|
||||
wally_init(0);
|
||||
secp256k1_ctx = wally_get_secp_context();
|
||||
|
||||
setup_tmpctx();
|
||||
common_setup(argv[0]);
|
||||
|
||||
if (!pubkey_from_hexstr("023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb", 66, &tlv3_node_id.node_id))
|
||||
abort();
|
||||
@ -636,6 +633,5 @@ int main(void)
|
||||
p2, tal_count(p2)));
|
||||
}
|
||||
}
|
||||
tal_free(tmpctx);
|
||||
wally_cleanup(0);
|
||||
common_shutdown();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user