| 26 | |
| 27 | |
| 28 | void common_setup(const char *argv0) |
| 29 | { |
| 30 | int wally_ret; |
| 31 | |
| 32 | setup_locale(); |
| 33 | err_set_progname(argv0); |
| 34 | |
| 35 | /* We rely on libsodium for some of the crypto stuff, so we'd better |
| 36 | * not start if it cannot do its job correctly. */ |
| 37 | if (sodium_init() == -1) |
| 38 | errx(1, "Could not initialize libsodium. Maybe not enough entropy" |
| 39 | " available ?"); |
| 40 | |
| 41 | /* We set up Wally, the bitcoin wallet lib */ |
| 42 | wally_ret = wally_init(0); |
| 43 | if (wally_ret != WALLY_OK) |
| 44 | errx(1, "Error initializing libwally: %i", wally_ret); |
| 45 | wally_ret = wally_set_operations(&wally_tal_ops); |
| 46 | if (wally_ret != WALLY_OK) |
| 47 | errx(1, "Error setting libwally operations: %i", wally_ret); |
| 48 | secp256k1_ctx = wally_get_secp_context(); |
| 49 | |
| 50 | setup_tmpctx(); |
| 51 | } |
| 52 | |
| 53 | void common_shutdown(void) |
| 54 | { |