Skip to content

Commit

Permalink
common/setup: check libwally initialization
Browse files Browse the repository at this point in the history
We already assume they were succesful, so we'd better be checking them.

Signed-off-by: Antoine Poinsot <[email protected]>
  • Loading branch information
darosior authored and rustyrussell committed Aug 14, 2021
1 parent 08d3212 commit 5d9be5a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions common/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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();
Expand Down

0 comments on commit 5d9be5a

Please sign in to comment.