Skip to content

Commit

Permalink
Properly initialize libsodium
Browse files Browse the repository at this point in the history
- It does not appear that monero does this at any point in their code.  This function needs called before any other function in the library
  • Loading branch information
who-biz committed Jul 17, 2019
1 parent c15dc19 commit 4ce7f5d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "p2p/net_node.h"
#include "rpc/core_rpc_server.h"
#include "rpc/rpc_args.h"
#include "sodium.h"
#include "daemon/command_line_args.h"
#include "blockchain_db/db_types.h"
#include "version.h"
Expand All @@ -59,6 +60,11 @@ int main(int argc, char* argv[])

// TODO parse the debug options like set log level right here at start

if (sodium_init() < 0)
{
MWARNING("Libsodium did not initialize properly. Trying again in a few seconds...");
}

tools::on_startup();

epee::string_tools::set_module_name_and_folder(argv[0]);
Expand Down Expand Up @@ -270,6 +276,11 @@ int main(int argc, char* argv[])
if (!command_line::is_arg_defaulted(vm, daemon_args::arg_max_concurrency))
tools::set_max_concurrency(command_line::get_arg(vm, daemon_args::arg_max_concurrency));

if (sodium_init() < 0) {
MERROR("Libsodium couldn't initialize. Shutting down...");
exit(-1);
}

// logging is now set up
MGINFO("Blur Network '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")");

Expand Down

0 comments on commit 4ce7f5d

Please sign in to comment.