From 5d9be5ab97af9fbf8072bad1d7741dc66ae4ddb4 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 11 May 2021 00:29:58 +0200 Subject: [PATCH] common/setup: check libwally initialization We already assume they were succesful, so we'd better be checking them. Signed-off-by: Antoine Poinsot --- common/setup.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/setup.c b/common/setup.c index 88fb25b4a..b9e73fc25 100644 --- a/common/setup.c +++ b/common/setup.c @@ -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();