diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c index 09cac0e95..b022d3211 100644 --- a/channeld/test/run-full_channel.c +++ b/channeld/test/run-full_channel.c @@ -335,8 +335,7 @@ int main(void) const u8 *funding_wscript, **wscripts; size_t i; - secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY - | SECP256K1_CONTEXT_SIGN); + secp256k1_ctx = wally_get_secp_context(); setup_tmpctx(); feerate_per_kw = tal_arr(tmpctx, u32, NUM_SIDES); @@ -623,7 +622,7 @@ int main(void) } /* No memory leaks please */ - secp256k1_context_destroy(secp256k1_ctx); + wally_cleanup(0); tal_free(tmpctx); /* FIXME: Do BOLT comparison! */ diff --git a/common/subdaemon.c b/common/subdaemon.c index 220dffed9..1a91f6ee0 100644 --- a/common/subdaemon.c +++ b/common/subdaemon.c @@ -12,6 +12,7 @@ #include #include #include +#include #if BACKTRACE_SUPPORTED static struct backtrace_state *backtrace_state; @@ -75,8 +76,7 @@ void subdaemon_setup(int argc, char *argv[]) /* We handle write returning errors! */ signal(SIGPIPE, SIG_IGN); - secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY - | SECP256K1_CONTEXT_SIGN); + secp256k1_ctx = wally_get_secp_context(); setup_tmpctx(); @@ -105,5 +105,5 @@ void subdaemon_setup(int argc, char *argv[]) void subdaemon_shutdown(void) { tal_free(tmpctx); - secp256k1_context_destroy(secp256k1_ctx); + wally_cleanup(0); } diff --git a/common/test/run-bolt11.c b/common/test/run-bolt11.c index aece9b5ac..874e831f3 100644 --- a/common/test/run-bolt11.c +++ b/common/test/run-bolt11.c @@ -5,6 +5,7 @@ #include #include #include +#include /* AUTOGENERATED MOCKS START */ /* Generated stub for fromwire_pubkey */ @@ -118,8 +119,7 @@ int main(void) struct pubkey node; u64 msatoshi; - secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY - | SECP256K1_CONTEXT_SIGN); + secp256k1_ctx = wally_get_secp_context(); setup_tmpctx(); /* BOLT #11: @@ -235,8 +235,7 @@ int main(void) test_b11("lnbc20m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqscc6gd6ql3jrc5yzme8v4ntcewwz5cnw92tz0pc8qcuufvq7khhr8wpald05e92xw006sq94mg8v2ndf4sefvf9sygkshp5zfem29trqq2yxxz7", b11, "One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"); /* FIXME: Test the others! */ - - secp256k1_context_destroy(secp256k1_ctx); + wally_cleanup(0); tal_free(tmpctx); return 0; } diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 7c4e981d4..376da2299 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -288,8 +288,7 @@ int main(int argc, char *argv[]) #endif ld = new_lightningd(NULL); - secp256k1_ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY - | SECP256K1_CONTEXT_SIGN); + secp256k1_ctx = wally_get_secp_context(); setup_tmpctx(); io_poll_override(debug_poll); @@ -428,6 +427,6 @@ int main(int argc, char *argv[]) memleak_cleanup(); #endif take_cleanup(); - secp256k1_context_destroy(secp256k1_ctx); + wally_cleanup(0); return 0; } diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index eccf4bc71..b2041625f 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -24,6 +24,7 @@ static void db_log_(struct log *log UNUSED, enum log_level level UNUSED, const c #include #include #include +#include bool deprecated_apis = true; @@ -1004,11 +1005,6 @@ int main(void) take_cleanup(); tal_free(tmpctx); - - /* FIXME! https://github.com/ElementsProject/libwally-core/issues/26 */ - { - secp256k1_context *secp_ctx(void); - secp256k1_context_destroy(secp_ctx()); - } + wally_cleanup(0); return !ok; }