diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_db/berkeleydb/db_bdb.cpp | 4 | ||||
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 10 | ||||
-rw-r--r-- | src/common/int-util.h | 2 | ||||
-rw-r--r-- | src/crypto/crypto.cpp | 2 | ||||
-rw-r--r-- | src/crypto/oaes_lib.c | 12 | ||||
-rw-r--r-- | src/crypto/slow-hash.c | 2 | ||||
-rw-r--r-- | src/crypto/tree-hash.c | 2 |
7 files changed, 20 insertions, 14 deletions
diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index 1ccb6be12..02fdaba2f 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -783,9 +783,11 @@ void BlockchainBDB::open(const std::string& filename, const int db_flags) m_env->set_lk_max_locks(DB_MAX_LOCKS); m_env->set_lk_max_lockers(DB_MAX_LOCKS); m_env->set_lk_max_objects(DB_MAX_LOCKS); - + + #ifndef __OpenBSD__ //OpenBSD's DB package is too old to support this feature if(m_auto_remove_logs) m_env->log_set_config(DB_LOG_AUTO_REMOVE, 1); + #endif // last parameter left 0, files will be created with default rw access m_env->open(filename.c_str(), db_env_open_flags, 0); diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 17a0f9ec2..c18db7724 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -654,9 +654,11 @@ void BlockchainLMDB::remove_transaction_data(const crypto::hash& tx_hash, const remove_tx_outputs(tx_hash, tx); - if (mdb_del(*m_write_txn, m_tx_outputs, &val_h, NULL)) - throw1(DB_ERROR("Failed to add removal of tx outputs to db transaction")); - + auto result = mdb_del(*m_write_txn, m_tx_outputs, &val_h, NULL); + if (result == MDB_NOTFOUND) + LOG_PRINT_L1("tx has no outputs to remove: " << tx_hash); + else if (result) + throw1(DB_ERROR(std::string("Failed to add removal of tx outputs to db transaction: ").append(mdb_strerror(result)).c_str())); } void BlockchainLMDB::add_output(const crypto::hash& tx_hash, const tx_out& tx_output, const uint64_t& local_index, const uint64_t unlock_time) @@ -718,7 +720,7 @@ void BlockchainLMDB::remove_tx_outputs(const crypto::hash& tx_hash, const transa auto result = mdb_cursor_get(cur, &k, &v, MDB_SET); if (result == MDB_NOTFOUND) { - LOG_ERROR("Attempting to remove a tx's outputs, but none found. Continuing, but...be wary, because that's weird."); + LOG_PRINT_L2("tx has no outputs, so no global output indices"); } else if (result) { diff --git a/src/common/int-util.h b/src/common/int-util.h index 45ee5ef70..e9eddee9c 100644 --- a/src/common/int-util.h +++ b/src/common/int-util.h @@ -137,6 +137,7 @@ static inline uint32_t div128_32(uint64_t dividend_hi, uint64_t dividend_lo, uin static inline uint32_t ident32(uint32_t x) { return x; } static inline uint64_t ident64(uint64_t x) { return x; } +#ifndef __OpenBSD__ static inline uint32_t swap32(uint32_t x) { x = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >> 8); return (x << 16) | (x >> 16); @@ -146,6 +147,7 @@ static inline uint64_t swap64(uint64_t x) { x = ((x & 0x0000ffff0000ffff) << 16) | ((x & 0xffff0000ffff0000) >> 16); return (x << 32) | (x >> 32); } +#endif #if defined(__GNUC__) #define UNUSED __attribute__((unused)) diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp index 1e39a8b04..fa7b1b580 100644 --- a/src/crypto/crypto.cpp +++ b/src/crypto/crypto.cpp @@ -41,7 +41,7 @@ #include "crypto.h" #include "hash.h" -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <alloca.h> #else #include <stdlib.h> diff --git a/src/crypto/oaes_lib.c b/src/crypto/oaes_lib.c index c86b8caa0..7fbe96e4c 100644 --- a/src/crypto/oaes_lib.c +++ b/src/crypto/oaes_lib.c @@ -37,13 +37,13 @@ static const char _NR[] = { #include <stdlib.h> #include <stdio.h> -// Both OS X and FreeBSD don't need malloc.h -#if !defined(__APPLE__) && !defined(__FreeBSD__) +// OS X, FreeBSD, and OpenBSD don't need malloc.h +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <malloc.h> #endif -// FreeBSD also doesn't need timeb.h -#ifndef __FreeBSD__ +// FreeBSD, and OpenBSD also don't need timeb.h +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <sys/timeb.h> #else #include <sys/time.h> @@ -470,7 +470,7 @@ OAES_RET oaes_sprintf( #ifdef OAES_HAVE_ISAAC static void oaes_get_seed( char buf[RANDSIZ + 1] ) { - #ifndef __FreeBSD__ + #if !defined(__FreeBSD__) && !defined(__OpenBSD__) struct timeb timer; struct tm *gmTimer; char * _test = NULL; @@ -502,7 +502,7 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] ) #else static uint32_t oaes_get_seed(void) { - #ifndef __FreeBSD__ + #if !defined(__FreeBSD__) && !defined(__OpenBSD__) struct timeb timer; struct tm *gmTimer; char * _test = NULL; diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index 544083fb0..903a3792f 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -421,7 +421,7 @@ void slow_hash_allocate_state(void) hp_state = (uint8_t *) VirtualAlloc(hp_state, MEMORY, MEM_LARGE_PAGES | MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); #else -#if defined(__APPLE__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, 0, 0); #else diff --git a/src/crypto/tree-hash.c b/src/crypto/tree-hash.c index e90b23841..7a128e4b0 100644 --- a/src/crypto/tree-hash.c +++ b/src/crypto/tree-hash.c @@ -34,7 +34,7 @@ #include "hash-ops.h" -#ifndef __FreeBSD__ +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) #include <alloca.h> #else #include <stdlib.h> |