aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--src/cryptonote_core/hardfork.cpp11
-rw-r--r--src/wallet/CMakeLists.txt26
3 files changed, 29 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70c0c89f7..0a0e75119 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -295,7 +295,7 @@ link_directories(${LIBUNWIND_LIBRARY_DIRS})
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(COMMON_C_FLAGS "${COMMON_C_FLAGS} /Dinline=__inline")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760")
+ set(COMMON_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} /STACK:10485760")
if(STATIC)
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
string(REPLACE "/MD" "/MT" ${VAR} "${${VAR}}")
@@ -333,7 +333,7 @@ else()
include_directories(SYSTEM src/platform/mingw)
# mingw doesn't support LTO (multiple definition errors at link time)
set(USE_LTO_DEFAULT false)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,10485760")
+ set(COMMON_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} -Wl,--stack,10485760")
if(NOT BUILD_64)
add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501)
endif()
@@ -420,9 +420,14 @@ else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
+
if(STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--wrap=__cxa_throw")
+ set(COMMON_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+ endif()
+
+ if(STATIC AND NOT FREEBSD AND NOT OPENBSD)
+ # Install hook on throw for dumping stack on exception (implemented in libcommon)
+ set(WRAP_CXA_THROW_FLAG "-Wl,--wrap=__cxa_throw")
endif()
endif()
@@ -471,9 +476,12 @@ endif()
include(version.cmake)
-# When building the following sources, treat warnings as errors
+# When building the following sources...
+# ...treat warnings as errors, install throw wrapper
set(CMAKE_C_FLAGS "${COMMON_C_FLAGS} ${WARNINGS_AS_ERRORS_FLAG}")
set(CMAKE_CXX_FLAGS "${COMMON_CXX_FLAGS} ${WARNINGS_AS_ERRORS_FLAG}")
+# ...install hook on throw
+set(CMAKE_EXE_LINKER_FLAGS "${COMMON_EXE_LINKER_FLAGS} ${WRAP_CXA_THROW_FLAG}")
add_subdirectory(contrib)
add_subdirectory(src)
@@ -482,9 +490,12 @@ add_subdirectory(src)
option(BUILD_TESTS "Build tests." OFF)
if(BUILD_TESTS)
- # When building tests, do *not* treat warnings as errors
+ # When building tests...
+ # ...do *not* treat warnings as errors
set(CMAKE_C_FLAGS "${COMMON_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${COMMON_CXX_FLAGS}")
+ # ...do *not* install hook on throw
+ set(CMAKE_EXE_LINKER_FLAGS "${COMMON_CXX_FLAGS}")
add_subdirectory(tests)
endif()
diff --git a/src/cryptonote_core/hardfork.cpp b/src/cryptonote_core/hardfork.cpp
index d3262dbe3..39c026b08 100644
--- a/src/cryptonote_core/hardfork.cpp
+++ b/src/cryptonote_core/hardfork.cpp
@@ -164,7 +164,7 @@ void HardFork::init()
// restore state from DB
uint64_t height = db.height();
if (height > window_size)
- height -= window_size;
+ height -= window_size - 1;
else
height = 1;
@@ -259,8 +259,7 @@ bool HardFork::rescan_from_block_height(uint64_t height)
for (size_t n = 0; n < 256; ++n)
last_versions[n] = 0;
- const uint64_t rescan_height = height >= (window_size - 1) ? height - (window_size -1) : 0;
- for (uint64_t h = rescan_height; h <= height; ++h) {
+ for (uint64_t h = height; h < db.height(); ++h) {
cryptonote::block b = db.get_block_from_height(h);
const uint8_t v = get_effective_version(get_block_vote(b));
last_versions[v]++;
@@ -271,6 +270,12 @@ bool HardFork::rescan_from_block_height(uint64_t height)
current_fork_index = 0;
while (current_fork_index + 1 < heights.size() && heights[current_fork_index].version != lastv)
++current_fork_index;
+
+ uint8_t voted = get_voted_fork_index(db.height());
+ if (voted > current_fork_index) {
+ current_fork_index = voted;
+ }
+
db.block_txn_stop();
return true;
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
index 086758c39..c4585f9ee 100644
--- a/src/wallet/CMakeLists.txt
+++ b/src/wallet/CMakeLists.txt
@@ -75,28 +75,10 @@ target_link_libraries(wallet
${Boost_REGEX_LIBRARY}
${EXTRA_LIBRARIES})
-
-# in case of static build, randon.c.obj from UNBOUND_LIBARY conflicts with the same file from 'crypto'
-# and in case of dynamic build, merge_static_libs called with ${UNBOUND_LIBRARY} will fail
-if (STATIC)
- set(libs_to_merge wallet cryptonote_core mnemonics common crypto)
- # hack - repack libunbound into another static lib - there's conflicting object file "random.c.obj"
- merge_static_libs(wallet_merged "${libs_to_merge}")
- merge_static_libs(wallet_merged2 "${UNBOUND_LIBRARY}")
- install(TARGETS wallet_merged wallet_merged2
- ARCHIVE DESTINATION lib)
-else (STATIC)
- set(libs_to_merge wallet cryptonote_core mnemonics common crypto ${UNBOUND_LIBRARY} )
- merge_static_libs(wallet_merged "${libs_to_merge}")
- install(TARGETS wallet_merged
- ARCHIVE DESTINATION lib)
-endif (STATIC)
-
-#MERGE_STATIC_LIBS(wallet_merged wallet_merged "${libs_to_merge}")
-
-
+set(libs_to_merge wallet cryptonote_core mnemonics common crypto)
+merge_static_libs(wallet_merged "${libs_to_merge}")
+install(TARGETS wallet_merged
+ ARCHIVE DESTINATION lib)
install(FILES ${wallet_api_headers}
DESTINATION include/wallet)
-
-