common/setup: check libwally initialization

We already assume they were succesful, so we'd better be checking them.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
Antoine Poinsot 2021-05-11 00:29:58 +02:00 committed by Rusty Russell
parent 08d32123d8
commit 5d9be5ab97

View File

@ -27,6 +27,8 @@ static struct wally_operations wally_tal_ops = {
void common_setup(const char *argv0)
{
int wally_ret;
setup_locale();
err_set_progname(argv0);
@ -37,8 +39,12 @@ void common_setup(const char *argv0)
" available ?");
/* We set up Wally, the bitcoin wallet lib */
wally_init(0);
wally_set_operations(&wally_tal_ops);
wally_ret = wally_init(0);
if (wally_ret != WALLY_OK)
errx(1, "Error initializing libwally: %i", wally_ret);
wally_ret = wally_set_operations(&wally_tal_ops);
if (wally_ret != WALLY_OK)
errx(1, "Error setting libwally operations: %i", wally_ret);
secp256k1_ctx = wally_get_secp_context();
setup_tmpctx();