Separate implementations of CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY.
[novacoin.git] / src / util.cpp
index f6d80f7..0f84938 100644 (file)
@@ -31,6 +31,7 @@ namespace boost {
 #include <boost/thread.hpp>
 #include <openssl/crypto.h>
 #include <openssl/rand.h>
+#include <openssl/conf.h>
 
 #ifdef WIN32
 #ifdef _MSC_VER
@@ -127,6 +128,13 @@ public:
             ppmutexOpenSSL[i] = new CCriticalSection();
         CRYPTO_set_locking_callback(locking_callback);
 
+        // OpenSSL can optionally load a config file which lists optional loadable modules and engines.
+        // We don't use them so we don't require the config. However some of our libs may call functions
+        // which attempt to load the config file, possibly resulting in an exit() or crash if it is missing
+        // or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be
+        // that the config appears to have been loaded and there are no modules/engines available.
+        OPENSSL_no_config();
+
 #ifdef WIN32
         // Seed random number generator with screen scrape and other hardware sources
         RAND_screen();
@@ -331,7 +339,7 @@ string vstrprintf(const char *format, va_list ap)
         if (p != buffer)
             delete[] p;
         limit *= 2;
-        p = new char[limit];
+        p = new(nothrow) char[limit];
         if (p == NULL)
             throw std::bad_alloc();
     }
@@ -1180,13 +1188,11 @@ void createConf()
     pConf << "rpcuser=user\nrpcpassword="
             + randomStrGen(15)
             + "\nrpcport=8344"
-            + "\nport=7777"
             + "\n#(0=off, 1=on) daemon - run in the background as a daemon and accept commands"
             + "\ndaemon=0"
             + "\n#(0=off, 1=on) server - accept command line and JSON-RPC commands"
             + "\nserver=0"
-            + "\nrpcallowip=127.0.0.1"
-            + "\ntestnet=0";
+            + "\nrpcallowip=127.0.0.1";
     pConf.close();
 }