mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 06:43:28 +01:00
Merge pull request #127 from fluffypony/master
FreeBSD compatibility and default log level changes
This commit is contained in:
commit
6a70de32bf
@ -1,3 +1,33 @@
|
|||||||
|
# Copyright (c) 2014, The Monero Project
|
||||||
|
#
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
# permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
# materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without specific
|
||||||
|
# prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8.6)
|
cmake_minimum_required(VERSION 2.8.6)
|
||||||
|
|
||||||
set(VERSION "0.1")
|
set(VERSION "0.1")
|
||||||
@ -7,6 +37,23 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|||||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
# Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead)
|
||||||
|
# CMAKE_SYSTEM_NAME checks are commonly known, but specifically taken from libsdl's CMakeLists
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
|
||||||
|
set(FREEBSD TRUE)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
|
||||||
|
set(FREEBSD TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO: check bsdi, NetBSD, OpenBSD, to see if they need the same FreeBSD changes
|
||||||
|
#
|
||||||
|
# elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
|
||||||
|
# set(NETBSD TRUE)
|
||||||
|
# elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
|
||||||
|
# set(OPENBSD TRUE)
|
||||||
|
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
|
||||||
|
# set(BSDI TRUE)
|
||||||
|
|
||||||
function(set_static_flags)
|
function(set_static_flags)
|
||||||
if (NOT APPLE)
|
if (NOT APPLE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||||
@ -140,5 +187,14 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(external)
|
add_subdirectory(external)
|
||||||
|
|
||||||
|
# Final setup for miniupnpc
|
||||||
|
if(UPNP_STATIC)
|
||||||
|
add_definitions("-DUPNP_STATIC")
|
||||||
|
else()
|
||||||
|
add_definitions("-DUPNP_DYNAMIC")
|
||||||
|
include_directories(${UPNP_INCLUDE})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
@ -1385,6 +1385,7 @@ POP_WARNINGS
|
|||||||
#define LOG_PRINT_MAGENTA(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_magenta)
|
#define LOG_PRINT_MAGENTA(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_magenta)
|
||||||
|
|
||||||
#define LOG_PRINT_RED_L0(mess) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, LOG_LEVEL_0, epee::log_space::console_color_red)
|
#define LOG_PRINT_RED_L0(mess) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, LOG_LEVEL_0, epee::log_space::console_color_red)
|
||||||
|
#define LOG_PRINT_RED_L1(mess) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, LOG_LEVEL_1, epee::log_space::console_color_red)
|
||||||
|
|
||||||
#define LOG_PRINT_L0(mess) LOG_PRINT(mess, LOG_LEVEL_0)
|
#define LOG_PRINT_L0(mess) LOG_PRINT(mess, LOG_LEVEL_0)
|
||||||
#define LOG_PRINT_L1(mess) LOG_PRINT(mess, LOG_LEVEL_1)
|
#define LOG_PRINT_L1(mess) LOG_PRINT(mess, LOG_LEVEL_1)
|
||||||
|
@ -376,7 +376,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
|
|||||||
|
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("[sock " << socket_.native_handle() << "] Some problems at write: " << e.message() << ':' << e.value());
|
LOG_PRINT_L1("[sock " << socket_.native_handle() << "] Some problems at write: " << e.message() << ':' << e.value());
|
||||||
shutdown();
|
shutdown();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ int levin_client_impl::invoke(int command, const std::string& in_buff, std::stri
|
|||||||
|
|
||||||
if(head.m_signature!=LEVIN_SIGNATURE)
|
if(head.m_signature!=LEVIN_SIGNATURE)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Signature missmatch in response");
|
LOG_PRINT_L1("Signature missmatch in response");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ inline
|
|||||||
|
|
||||||
if(head.m_signature!=LEVIN_SIGNATURE)
|
if(head.m_signature!=LEVIN_SIGNATURE)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Signature missmatch in response");
|
LOG_PRINT_L1("Signature missmatch in response");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ namespace net_utils
|
|||||||
boost::smatch result;
|
boost::smatch result;
|
||||||
if(!boost::regex_search(uri, result, rexp_match_uri, boost::match_default) && result[0].matched)
|
if(!boost::regex_search(uri, result, rexp_match_uri, boost::match_default) && result[0].matched)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("[PARSE URI] regex not matched for uri: " << uri);
|
LOG_PRINT_L1("[PARSE URI] regex not matched for uri: " << uri);
|
||||||
content.m_path = uri;
|
content.m_path = uri;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ namespace net_utils
|
|||||||
boost::smatch result;
|
boost::smatch result;
|
||||||
if(!boost::regex_search(url_str, result, rexp_match_uri, boost::match_default) && result[0].matched)
|
if(!boost::regex_search(url_str, result, rexp_match_uri, boost::match_default) && result[0].matched)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("[PARSE URI] regex not matched for uri: " << rexp_match_uri);
|
LOG_PRINT_L1("[PARSE URI] regex not matched for uri: " << rexp_match_uri);
|
||||||
//content.m_path = uri;
|
//content.m_path = uri;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ namespace net_utils
|
|||||||
#define LOG_PRINT_CC_YELLOW(ct, message, log_level) LOG_PRINT_YELLOW("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
|
#define LOG_PRINT_CC_YELLOW(ct, message, log_level) LOG_PRINT_YELLOW("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
|
||||||
#define LOG_PRINT_CC_CYAN(ct, message, log_level) LOG_PRINT_CYAN("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
|
#define LOG_PRINT_CC_CYAN(ct, message, log_level) LOG_PRINT_CYAN("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
|
||||||
#define LOG_PRINT_CC_MAGENTA(ct, message, log_level) LOG_PRINT_MAGENTA("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
|
#define LOG_PRINT_CC_MAGENTA(ct, message, log_level) LOG_PRINT_MAGENTA("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
|
||||||
#define LOG_ERROR_CC(ct, message) LOG_ERROR("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
|
#define LOG_ERROR_CC(ct, message) LOG_PRINT_RED("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, LOG_LEVEL_1)
|
||||||
|
|
||||||
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
|
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
|
||||||
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
|
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
|
||||||
|
245
external/CMakeLists.txt
vendored
245
external/CMakeLists.txt
vendored
@ -1,11 +1,238 @@
|
|||||||
set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library")
|
# Copyright (c) 2014, The Monero Project
|
||||||
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library")
|
#
|
||||||
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables")
|
# All rights reserved.
|
||||||
add_subdirectory(miniupnpc)
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
# permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
# materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without specific
|
||||||
|
# prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
set_property(TARGET upnpc-static PROPERTY FOLDER "external")
|
# --------------------------------- FindMiniupnpc Start ---------------------------------
|
||||||
if(MSVC)
|
# Locate miniupnp library
|
||||||
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
|
# This module defines
|
||||||
elseif(NOT MSVC)
|
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
|
||||||
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
|
# MINIUPNP_LIBRARY, the miniupnp variant
|
||||||
|
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
|
||||||
|
# MINIUPNPC_VERSION_PRE1_6 --> set if we detect the version of miniupnpc is
|
||||||
|
# pre 1.6
|
||||||
|
# MINIUPNPC_VERSION_PRE1_5 --> set if we detect the version of miniupnpc is
|
||||||
|
# pre 1.5
|
||||||
|
#
|
||||||
|
# Note that the expected include convention is
|
||||||
|
# #include "miniupnpc.h"
|
||||||
|
# and not
|
||||||
|
# #include <miniupnpc/miniupnpc.h>
|
||||||
|
# This is because, the miniupnpc location is not standardized and may exist
|
||||||
|
# in locations other than miniupnpc/
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2011 Mark Vejvoda
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distributed this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||||
|
# Already in cache, be silent
|
||||||
|
set(MINIUPNP_FIND_QUIETLY TRUE)
|
||||||
|
endif (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||||
|
|
||||||
|
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
|
||||||
|
PATH_SUFFIXES miniupnpc)
|
||||||
|
find_library(MINIUPNP_LIBRARY miniupnpc)
|
||||||
|
|
||||||
|
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||||
|
set (MINIUPNP_FOUND TRUE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (MINIUPNP_FOUND)
|
||||||
|
include(CheckCXXSourceRuns)
|
||||||
|
if (NOT MINIUPNP_FIND_QUIETLY)
|
||||||
|
message (STATUS "Found the miniupnpc libraries at ${MINIUPNP_LIBRARY}")
|
||||||
|
message (STATUS "Found the miniupnpc headers at ${MINIUPNP_INCLUDE_DIR}")
|
||||||
|
endif (NOT MINIUPNP_FIND_QUIETLY)
|
||||||
|
|
||||||
|
message(STATUS "Detecting version of miniupnpc in path: ${MINIUPNP_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||||
|
check_cxx_source_runs("
|
||||||
|
#include <miniwget.h>
|
||||||
|
#include <miniupnpc.h>
|
||||||
|
#include <upnpcommands.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
static struct UPNPUrls urls;
|
||||||
|
static struct IGDdatas data;
|
||||||
|
|
||||||
|
GetUPNPUrls (&urls, &data, \"myurl\",0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||||
|
|
||||||
|
IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||||
|
check_cxx_source_runs("
|
||||||
|
#include <miniwget.h>
|
||||||
|
#include <miniupnpc.h>
|
||||||
|
#include <upnpcommands.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
struct UPNPDev *devlist = NULL;
|
||||||
|
int upnp_delay = 5000;
|
||||||
|
const char *upnp_multicastif = NULL;
|
||||||
|
const char *upnp_minissdpdsock = NULL;
|
||||||
|
int upnp_sameport = 0;
|
||||||
|
int upnp_ipv6 = 0;
|
||||||
|
int upnp_error = 0;
|
||||||
|
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport, upnp_ipv6, &upnp_error);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
MINIUPNPC_VERSION_PRE1_7)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||||
|
check_cxx_source_runs("
|
||||||
|
#include <miniwget.h>
|
||||||
|
#include <miniupnpc.h>
|
||||||
|
#include <upnpcommands.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
struct UPNPDev *devlist = NULL;
|
||||||
|
int upnp_delay = 5000;
|
||||||
|
const char *upnp_multicastif = NULL;
|
||||||
|
const char *upnp_minissdpdsock = NULL;
|
||||||
|
int upnp_sameport = 0;
|
||||||
|
int upnp_ipv6 = 0;
|
||||||
|
int upnp_error = 0;
|
||||||
|
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
MINIUPNPC_VERSION_PRE1_6)
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||||
|
check_cxx_source_runs("
|
||||||
|
#include <miniwget.h>
|
||||||
|
#include <miniupnpc.h>
|
||||||
|
#include <upnpcommands.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
static struct UPNPUrls urls;
|
||||||
|
static struct IGDdatas data;
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char externalIP[16] = \"\";
|
||||||
|
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
MINIUPNPC_VERSION_1_5_OR_HIGHER)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||||
|
check_cxx_source_runs("
|
||||||
|
#include <miniwget.h>
|
||||||
|
#include <miniupnpc.h>
|
||||||
|
#include <upnpcommands.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
static struct UPNPUrls urls;
|
||||||
|
static struct IGDdatas data;
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
char externalIP[16] = \"\";
|
||||||
|
UPNP_GetExternalIPAddress(urls.controlURL, data.servicetype, externalIP);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
MINIUPNPC_VERSION_PRE1_5)
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(MINIUPNPC_VERSION_PRE1_5)
|
||||||
|
message(STATUS "Found miniupnpc version is pre v1.5")
|
||||||
|
ENDIF()
|
||||||
|
IF(MINIUPNPC_VERSION_PRE1_6)
|
||||||
|
message(STATUS "Found miniupnpc version is pre v1.6")
|
||||||
|
ENDIF()
|
||||||
|
IF(MINIUPNPC_VERSION_PRE1_7)
|
||||||
|
message(STATUS "Found miniupnpc version is pre v1.7")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
|
||||||
|
message(STATUS "Found miniupnpc version is v1.7 or higher")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
else ()
|
||||||
|
message (STATUS "Could not find miniupnp")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY)
|
||||||
|
# --------------------------------- FindMiniupnpc End ---------------------------------
|
||||||
|
|
||||||
|
# And now on to the Monero part of things
|
||||||
|
|
||||||
|
if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||||
|
message(STATUS "Using shared miniupnpc found at ${MINIUPNP_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
set(UPNP_STATIC false PARENT_SCOPE)
|
||||||
|
set(UPNP_INCLUDE ${MINIUPNP_INCLUDE_DIR} PARENT_SCOPE)
|
||||||
|
set(UPNP_LIBRARIES ${MINIUPNP_LIBRARY} PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
message(STATUS "Using static miniupnpc from external")
|
||||||
|
|
||||||
|
set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library")
|
||||||
|
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library")
|
||||||
|
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables")
|
||||||
|
add_subdirectory(miniupnpc)
|
||||||
|
|
||||||
|
set_property(TARGET upnpc-static PROPERTY FOLDER "external")
|
||||||
|
if(MSVC)
|
||||||
|
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
|
||||||
|
elseif(NOT MSVC)
|
||||||
|
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(UPNP_STATIC true PARENT_SCOPE)
|
||||||
|
set(UPNP_LIBRARIES "upnpc-static")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,3 +1,33 @@
|
|||||||
|
# Copyright (c) 2014, The Monero Project
|
||||||
|
#
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
# permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
# materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without specific
|
||||||
|
# prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
add_definitions(-DSTATICLIB)
|
add_definitions(-DSTATICLIB)
|
||||||
|
|
||||||
file(GLOB_RECURSE COMMON common/*)
|
file(GLOB_RECURSE COMMON common/*)
|
||||||
@ -30,13 +60,13 @@ add_library(cryptonote_core ${CRYPTONOTE_CORE})
|
|||||||
add_executable(daemon ${DAEMON} ${P2P} ${CRYPTONOTE_PROTOCOL})
|
add_executable(daemon ${DAEMON} ${P2P} ${CRYPTONOTE_PROTOCOL})
|
||||||
add_executable(connectivity_tool ${CONN_TOOL})
|
add_executable(connectivity_tool ${CONN_TOOL})
|
||||||
add_executable(simpleminer ${MINER})
|
add_executable(simpleminer ${MINER})
|
||||||
target_link_libraries(daemon rpc cryptonote_core crypto common upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(daemon rpc cryptonote_core crypto common ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
target_link_libraries(connectivity_tool cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(connectivity_tool cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
target_link_libraries(simpleminer cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(simpleminer cryptonote_core crypto common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
add_library(rpc ${RPC})
|
add_library(rpc ${RPC})
|
||||||
add_library(wallet ${WALLET})
|
add_library(wallet ${WALLET})
|
||||||
add_executable(simplewallet ${SIMPLEWALLET} )
|
add_executable(simplewallet ${SIMPLEWALLET} )
|
||||||
target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(simplewallet wallet rpc cryptonote_core crypto common ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
add_dependencies(daemon version)
|
add_dependencies(daemon version)
|
||||||
add_dependencies(rpc version)
|
add_dependencies(rpc version)
|
||||||
add_dependencies(simplewallet version)
|
add_dependencies(simplewallet version)
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
//
|
//
|
||||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
#include <alloca.h>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -42,6 +41,12 @@
|
|||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|
||||||
|
#ifndef __FreeBSD__
|
||||||
|
#include <alloca.h>
|
||||||
|
#else
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace crypto {
|
namespace crypto {
|
||||||
|
|
||||||
using std::abort;
|
using std::abort;
|
||||||
|
@ -33,13 +33,20 @@ static const char _NR[] = {
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/timeb.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef __APPLE__
|
// Both OS X and FreeBSD don't need malloc.h
|
||||||
#include <malloc.h>
|
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// FreeBSD also doesn't need timeb.h
|
||||||
|
#ifndef __FreeBSD__
|
||||||
|
#include <sys/timeb.h>
|
||||||
|
#else
|
||||||
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -463,6 +470,7 @@ OAES_RET oaes_sprintf(
|
|||||||
#ifdef OAES_HAVE_ISAAC
|
#ifdef OAES_HAVE_ISAAC
|
||||||
static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
||||||
{
|
{
|
||||||
|
#ifndef __FreeBSD__
|
||||||
struct timeb timer;
|
struct timeb timer;
|
||||||
struct tm *gmTimer;
|
struct tm *gmTimer;
|
||||||
char * _test = NULL;
|
char * _test = NULL;
|
||||||
@ -474,6 +482,19 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
|||||||
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
||||||
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.millitm,
|
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.millitm,
|
||||||
_test + timer.millitm, getpid() );
|
_test + timer.millitm, getpid() );
|
||||||
|
#else
|
||||||
|
struct timeval timer;
|
||||||
|
struct tm *gmTimer;
|
||||||
|
char * _test = NULL;
|
||||||
|
|
||||||
|
gettimeofday(&timer, NULL);
|
||||||
|
gmTimer = gmtime( &timer.tv_sec );
|
||||||
|
_test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
|
||||||
|
sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
|
||||||
|
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
||||||
|
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.tv_usec/1000,
|
||||||
|
_test + timer.tv_usec/1000, getpid() );
|
||||||
|
#endif
|
||||||
|
|
||||||
if( _test )
|
if( _test )
|
||||||
free( _test );
|
free( _test );
|
||||||
@ -481,6 +502,7 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
|||||||
#else
|
#else
|
||||||
static uint32_t oaes_get_seed(void)
|
static uint32_t oaes_get_seed(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __FreeBSD__
|
||||||
struct timeb timer;
|
struct timeb timer;
|
||||||
struct tm *gmTimer;
|
struct tm *gmTimer;
|
||||||
char * _test = NULL;
|
char * _test = NULL;
|
||||||
@ -492,6 +514,19 @@ static uint32_t oaes_get_seed(void)
|
|||||||
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
||||||
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
|
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
|
||||||
(uintptr_t) ( _test + timer.millitm ) + getpid();
|
(uintptr_t) ( _test + timer.millitm ) + getpid();
|
||||||
|
#else
|
||||||
|
struct timeval timer;
|
||||||
|
struct tm *gmTimer;
|
||||||
|
char * _test = NULL;
|
||||||
|
uint32_t _ret = 0;
|
||||||
|
|
||||||
|
gettimeofday(&timer, NULL);
|
||||||
|
gmTimer = gmtime( &timer.tv_sec );
|
||||||
|
_test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
|
||||||
|
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
||||||
|
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.tv_usec/1000 +
|
||||||
|
(uintptr_t) ( _test + timer.tv_usec/1000 ) + getpid();
|
||||||
|
#endif
|
||||||
|
|
||||||
if( _test )
|
if( _test )
|
||||||
free( _test );
|
free( _test );
|
||||||
|
@ -330,7 +330,7 @@ void slow_hash_allocate_state(void)
|
|||||||
hp_state = (uint8_t *) VirtualAlloc(hp_state, MEMORY, MEM_LARGE_PAGES |
|
hp_state = (uint8_t *) VirtualAlloc(hp_state, MEMORY, MEM_LARGE_PAGES |
|
||||||
MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||||
#else
|
#else
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE,
|
hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE,
|
||||||
MAP_PRIVATE | MAP_ANON, 0, 0);
|
MAP_PRIVATE | MAP_ANON, 0, 0);
|
||||||
#else
|
#else
|
||||||
|
@ -28,13 +28,18 @@
|
|||||||
//
|
//
|
||||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
#include <alloca.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "hash-ops.h"
|
#include "hash-ops.h"
|
||||||
|
|
||||||
|
#ifndef __FreeBSD__
|
||||||
|
#include <alloca.h>
|
||||||
|
#else
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Quick check if this is power of two (use on unsigned types; in this case for size_t only)
|
/// Quick check if this is power of two (use on unsigned types; in this case for size_t only)
|
||||||
bool ispowerof2_size_t(size_t x) {
|
bool ispowerof2_size_t(size_t x) {
|
||||||
return x && !(x & (x - 1));
|
return x && !(x & (x - 1));
|
||||||
|
@ -403,17 +403,17 @@ bool blockchain_storage::rollback_blockchain_switching(std::list<block>& origina
|
|||||||
for(size_t i = m_blocks.size()-1; i >=rollback_height; i--)
|
for(size_t i = m_blocks.size()-1; i >=rollback_height; i--)
|
||||||
{
|
{
|
||||||
bool r = pop_block_from_blockchain();
|
bool r = pop_block_from_blockchain();
|
||||||
CHECK_AND_ASSERT_MES(r, false, "PANIC!!! failed to remove block while chain switching during the rollback!");
|
CHECK_AND_ASSERT_MES(r, false, "PANIC! failed to remove block while chain switching during the rollback!");
|
||||||
}
|
}
|
||||||
//return back original chain
|
//return back original chain
|
||||||
BOOST_FOREACH(auto& bl, original_chain)
|
BOOST_FOREACH(auto& bl, original_chain)
|
||||||
{
|
{
|
||||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||||
bool r = handle_block_to_main_chain(bl, bvc);
|
bool r = handle_block_to_main_chain(bl, bvc);
|
||||||
CHECK_AND_ASSERT_MES(r && bvc.m_added_to_main_chain, false, "PANIC!!! failed to add (again) block while chain switching during the rollback!");
|
CHECK_AND_ASSERT_MES(r && bvc.m_added_to_main_chain, false, "PANIC! failed to add (again) block while chain switching during the rollback!");
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_PRINT_L0("Rollback success.");
|
LOG_PRINT_L1("Rollback success.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
@ -443,10 +443,10 @@ bool blockchain_storage::switch_to_alternative_blockchain(std::list<blocks_ext_b
|
|||||||
bool r = handle_block_to_main_chain(ch_ent->second.bl, bvc);
|
bool r = handle_block_to_main_chain(ch_ent->second.bl, bvc);
|
||||||
if(!r || !bvc.m_added_to_main_chain)
|
if(!r || !bvc.m_added_to_main_chain)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to switch to alternative blockchain");
|
LOG_PRINT_L1("Failed to switch to alternative blockchain");
|
||||||
rollback_blockchain_switching(disconnected_chain, split_height);
|
rollback_blockchain_switching(disconnected_chain, split_height);
|
||||||
add_block_as_invalid(ch_ent->second, get_block_hash(ch_ent->second.bl));
|
add_block_as_invalid(ch_ent->second, get_block_hash(ch_ent->second.bl));
|
||||||
LOG_PRINT_L0("The block was inserted as invalid while connecting new alternative chain, block_id: " << get_block_hash(ch_ent->second.bl));
|
LOG_PRINT_L1("The block was inserted as invalid while connecting new alternative chain, block_id: " << get_block_hash(ch_ent->second.bl));
|
||||||
m_alternative_chains.erase(ch_ent);
|
m_alternative_chains.erase(ch_ent);
|
||||||
|
|
||||||
for(auto alt_ch_to_orph_iter = ++alt_ch_iter; alt_ch_to_orph_iter != alt_chain.end(); alt_ch_to_orph_iter++)
|
for(auto alt_ch_to_orph_iter = ++alt_ch_iter; alt_ch_to_orph_iter != alt_chain.end(); alt_ch_to_orph_iter++)
|
||||||
@ -468,7 +468,7 @@ bool blockchain_storage::switch_to_alternative_blockchain(std::list<blocks_ext_b
|
|||||||
bool r = handle_alternative_block(old_ch_ent, get_block_hash(old_ch_ent), bvc);
|
bool r = handle_alternative_block(old_ch_ent, get_block_hash(old_ch_ent), bvc);
|
||||||
if(!r)
|
if(!r)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Failed to push ex-main chain blocks to alternative chain ");
|
LOG_PRINT_L1("Failed to push ex-main chain blocks to alternative chain ");
|
||||||
rollback_blockchain_switching(disconnected_chain, split_height);
|
rollback_blockchain_switching(disconnected_chain, split_height);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -536,17 +536,17 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t
|
|||||||
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type");
|
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type");
|
||||||
if(boost::get<txin_gen>(b.miner_tx.vin[0]).height != height)
|
if(boost::get<txin_gen>(b.miner_tx.vin[0]).height != height)
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("The miner transaction in block has invalid height: " << boost::get<txin_gen>(b.miner_tx.vin[0]).height << ", expected: " << height);
|
LOG_PRINT_RED_L1("The miner transaction in block has invalid height: " << boost::get<txin_gen>(b.miner_tx.vin[0]).height << ", expected: " << height);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW,
|
CHECK_AND_ASSERT_MES(b.miner_tx.unlock_time == height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW,
|
||||||
false,
|
false,
|
||||||
"coinbase transaction transaction have wrong unlock time=" << b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW);
|
"coinbase transaction transaction has the wrong unlock time=" << b.miner_tx.unlock_time << ", expected " << height + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW);
|
||||||
|
|
||||||
//check outs overflow
|
//check outs overflow
|
||||||
if(!check_outs_overflow(b.miner_tx))
|
if(!check_outs_overflow(b.miner_tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("miner transaction have money overflow in block " << get_block_hash(b));
|
LOG_PRINT_RED_L1("miner transaction has money overflow in block " << get_block_hash(b));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,17 +563,17 @@ bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumul
|
|||||||
std::vector<size_t> last_blocks_sizes;
|
std::vector<size_t> last_blocks_sizes;
|
||||||
get_last_n_blocks_sizes(last_blocks_sizes, CRYPTONOTE_REWARD_BLOCKS_WINDOW);
|
get_last_n_blocks_sizes(last_blocks_sizes, CRYPTONOTE_REWARD_BLOCKS_WINDOW);
|
||||||
if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward)) {
|
if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward)) {
|
||||||
LOG_PRINT_L0("block size " << cumulative_block_size << " is bigger than allowed for this blockchain");
|
LOG_PRINT_L1("block size " << cumulative_block_size << " is bigger than allowed for this blockchain");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(base_reward + fee < money_in_use)
|
if(base_reward + fee < money_in_use)
|
||||||
{
|
{
|
||||||
LOG_ERROR("coinbase transaction spend too much money (" << print_money(money_in_use) << "). Block reward is " << print_money(base_reward + fee) << "(" << print_money(base_reward) << "+" << print_money(fee) << ")");
|
LOG_PRINT_L1("coinbase transaction spend too much money (" << print_money(money_in_use) << "). Block reward is " << print_money(base_reward + fee) << "(" << print_money(base_reward) << "+" << print_money(fee) << ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(base_reward + fee != money_in_use)
|
if(base_reward + fee != money_in_use)
|
||||||
{
|
{
|
||||||
LOG_ERROR("coinbase transaction doesn't use full amount of block reward: spent: "
|
LOG_PRINT_L1("coinbase transaction doesn't use full amount of block reward: spent: "
|
||||||
<< print_money(money_in_use) << ", block reward " << print_money(base_reward + fee) << "(" << print_money(base_reward) << "+" << print_money(fee) << ")");
|
<< print_money(money_in_use) << ", block reward " << print_money(base_reward + fee) << "(" << print_money(base_reward) << "+" << print_money(fee) << ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -706,7 +706,7 @@ bool blockchain_storage::create_block_template(block& b, const account_public_ad
|
|||||||
b.miner_tx.extra.resize(b.miner_tx.extra.size() - 1);
|
b.miner_tx.extra.resize(b.miner_tx.extra.size() - 1);
|
||||||
if (cumulative_size != txs_size + get_object_blobsize(b.miner_tx)) {
|
if (cumulative_size != txs_size + get_object_blobsize(b.miner_tx)) {
|
||||||
//fuck, not lucky, -1 makes varint-counter size smaller, in that case we continue to grow with cumulative_size
|
//fuck, not lucky, -1 makes varint-counter size smaller, in that case we continue to grow with cumulative_size
|
||||||
LOG_PRINT_RED("Miner tx creation have no luck with delta_extra size = " << delta << " and " << delta - 1 , LOG_LEVEL_2);
|
LOG_PRINT_RED("Miner tx creation has no luck with delta_extra size = " << delta << " and " << delta - 1 , LOG_LEVEL_2);
|
||||||
cumulative_size += delta - 1;
|
cumulative_size += delta - 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -751,13 +751,13 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||||||
uint64_t block_height = get_block_height(b);
|
uint64_t block_height = get_block_height(b);
|
||||||
if(0 == block_height)
|
if(0 == block_height)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Block with id: " << epee::string_tools::pod_to_hex(id) << " (as alternative) have wrong miner transaction");
|
LOG_PRINT_L1("Block with id: " << epee::string_tools::pod_to_hex(id) << " (as alternative) has wrong miner transaction");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!m_checkpoints.is_alternative_block_allowed(get_current_blockchain_height(), block_height))
|
if (!m_checkpoints.is_alternative_block_allowed(get_current_blockchain_height(), block_height))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("Block with id: " << id
|
LOG_PRINT_RED_L1("Block with id: " << id
|
||||||
<< ENDL << " can't be accepted for alternative chain, block height: " << block_height
|
<< ENDL << " can't be accepted for alternative chain, block height: " << block_height
|
||||||
<< ENDL << " blockchain height: " << get_current_blockchain_height());
|
<< ENDL << " blockchain height: " << get_current_blockchain_height());
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
@ -789,7 +789,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||||||
CHECK_AND_ASSERT_MES(m_blocks.size() > alt_chain.front()->second.height, false, "main blockchain wrong height");
|
CHECK_AND_ASSERT_MES(m_blocks.size() > alt_chain.front()->second.height, false, "main blockchain wrong height");
|
||||||
crypto::hash h = null_hash;
|
crypto::hash h = null_hash;
|
||||||
get_block_hash(m_blocks[alt_chain.front()->second.height - 1].bl, h);
|
get_block_hash(m_blocks[alt_chain.front()->second.height - 1].bl, h);
|
||||||
CHECK_AND_ASSERT_MES(h == alt_chain.front()->second.bl.prev_id, false, "alternative chain have wrong connection to main chain");
|
CHECK_AND_ASSERT_MES(h == alt_chain.front()->second.bl.prev_id, false, "alternative chain has wrong connection to main chain");
|
||||||
complete_timestamps_vector(alt_chain.front()->second.height - 1, timestamps);
|
complete_timestamps_vector(alt_chain.front()->second.height - 1, timestamps);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
@ -799,8 +799,8 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||||||
//check timestamp correct
|
//check timestamp correct
|
||||||
if(!check_block_timestamp(timestamps, b))
|
if(!check_block_timestamp(timestamps, b))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("Block with id: " << id
|
LOG_PRINT_RED_L1("Block with id: " << id
|
||||||
<< ENDL << " for alternative chain, have invalid timestamp: " << b.timestamp);
|
<< ENDL << " for alternative chain, has invalid timestamp: " << b.timestamp);
|
||||||
//add_block_as_invalid(b, id);//do not add blocks to invalid storage before proof of work check was passed
|
//add_block_as_invalid(b, id);//do not add blocks to invalid storage before proof of work check was passed
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -826,8 +826,8 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||||||
get_block_longhash(bei.bl, proof_of_work, bei.height);
|
get_block_longhash(bei.bl, proof_of_work, bei.height);
|
||||||
if(!check_hash(proof_of_work, current_diff))
|
if(!check_hash(proof_of_work, current_diff))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("Block with id: " << id
|
LOG_PRINT_RED_L1("Block with id: " << id
|
||||||
<< ENDL << " for alternative chain, have not enough proof of work: " << proof_of_work
|
<< ENDL << " for alternative chain, does not have enough proof of work: " << proof_of_work
|
||||||
<< ENDL << " expected difficulty: " << current_diff);
|
<< ENDL << " expected difficulty: " << current_diff);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -835,8 +835,8 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||||||
|
|
||||||
if(!prevalidate_miner_transaction(b, bei.height))
|
if(!prevalidate_miner_transaction(b, bei.height))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("Block with id: " << epee::string_tools::pod_to_hex(id)
|
LOG_PRINT_RED_L1("Block with id: " << epee::string_tools::pod_to_hex(id)
|
||||||
<< " (as alternative) have wrong miner transaction.");
|
<< " (as alternative) has incorrect miner transaction.");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -883,7 +883,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||||||
{
|
{
|
||||||
//block orphaned
|
//block orphaned
|
||||||
bvc.m_marked_as_orphaned = true;
|
bvc.m_marked_as_orphaned = true;
|
||||||
LOG_PRINT_RED_L0("Block recognized as orphaned and rejected, id = " << id);
|
LOG_PRINT_RED_L1("Block recognized as orphaned and rejected, id = " << id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -899,7 +899,7 @@ bool blockchain_storage::get_blocks(uint64_t start_offset, size_t count, std::li
|
|||||||
blocks.push_back(m_blocks[i].bl);
|
blocks.push_back(m_blocks[i].bl);
|
||||||
std::list<crypto::hash> missed_ids;
|
std::list<crypto::hash> missed_ids;
|
||||||
get_transactions(m_blocks[i].bl.tx_hashes, txs, missed_ids);
|
get_transactions(m_blocks[i].bl.tx_hashes, txs, missed_ids);
|
||||||
CHECK_AND_ASSERT_MES(!missed_ids.size(), false, "have missed transactions in own block in main blockchain");
|
CHECK_AND_ASSERT_MES(!missed_ids.size(), false, "has missed transactions in own block in main blockchain");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -928,7 +928,7 @@ bool blockchain_storage::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request&
|
|||||||
std::list<crypto::hash> missed_tx_id;
|
std::list<crypto::hash> missed_tx_id;
|
||||||
std::list<transaction> txs;
|
std::list<transaction> txs;
|
||||||
get_transactions(bl.tx_hashes, txs, rsp.missed_ids);
|
get_transactions(bl.tx_hashes, txs, rsp.missed_ids);
|
||||||
CHECK_AND_ASSERT_MES(!missed_tx_id.size(), false, "Internal error: have missed missed_tx_id.size()=" << missed_tx_id.size()
|
CHECK_AND_ASSERT_MES(!missed_tx_id.size(), false, "Internal error: has missed missed_tx_id.size()=" << missed_tx_id.size()
|
||||||
<< ENDL << "for block id = " << get_block_hash(bl));
|
<< ENDL << "for block id = " << get_block_hash(bl));
|
||||||
rsp.blocks.push_back(block_complete_entry());
|
rsp.blocks.push_back(block_complete_entry());
|
||||||
block_complete_entry& e = rsp.blocks.back();
|
block_complete_entry& e = rsp.blocks.back();
|
||||||
@ -1015,7 +1015,7 @@ bool blockchain_storage::get_random_outs_for_amounts(const COMMAND_RPC_GET_RANDO
|
|||||||
auto it = m_outputs.find(amount);
|
auto it = m_outputs.find(amount);
|
||||||
if(it == m_outputs.end())
|
if(it == m_outputs.end())
|
||||||
{
|
{
|
||||||
LOG_ERROR("COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS: not outs for amount " << amount << ", wallet should use some real outs when it lookup for some mix, so, at least one out for this amount should exist");
|
LOG_PRINT_L1("COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS: not outs for amount " << amount << ", wallet should use some real outs when it lookup for some mix, so, at least one out for this amount should exist");
|
||||||
continue;//actually this is strange situation, wallet should use some real outs when it lookup for some mix, so, at least one out for this amount should exist
|
continue;//actually this is strange situation, wallet should use some real outs when it lookup for some mix, so, at least one out for this amount should exist
|
||||||
}
|
}
|
||||||
std::vector<std::pair<crypto::hash, size_t> >& amount_outs = it->second;
|
std::vector<std::pair<crypto::hash, size_t> >& amount_outs = it->second;
|
||||||
@ -1053,13 +1053,13 @@ bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash
|
|||||||
|
|
||||||
if(!qblock_ids.size() /*|| !req.m_total_height*/)
|
if(!qblock_ids.size() /*|| !req.m_total_height*/)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Client sent wrong NOTIFY_REQUEST_CHAIN: m_block_ids.size()=" << qblock_ids.size() << /*", m_height=" << req.m_total_height <<*/ ", dropping connection");
|
LOG_PRINT_L1("Client sent wrong NOTIFY_REQUEST_CHAIN: m_block_ids.size()=" << qblock_ids.size() << /*", m_height=" << req.m_total_height <<*/ ", dropping connection");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//check genesis match
|
//check genesis match
|
||||||
if(qblock_ids.back() != get_block_hash(m_blocks[0].bl))
|
if(qblock_ids.back() != get_block_hash(m_blocks[0].bl))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Client sent wrong NOTIFY_REQUEST_CHAIN: genesis block missmatch: " << ENDL << "id: "
|
LOG_PRINT_L1("Client sent wrong NOTIFY_REQUEST_CHAIN: genesis block missmatch: " << ENDL << "id: "
|
||||||
<< qblock_ids.back() << ", " << ENDL << "expected: " << get_block_hash(m_blocks[0].bl)
|
<< qblock_ids.back() << ", " << ENDL << "expected: " << get_block_hash(m_blocks[0].bl)
|
||||||
<< "," << ENDL << " dropping connection");
|
<< "," << ENDL << " dropping connection");
|
||||||
return false;
|
return false;
|
||||||
@ -1078,14 +1078,14 @@ bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash
|
|||||||
|
|
||||||
if(bl_it == qblock_ids.end())
|
if(bl_it == qblock_ids.end())
|
||||||
{
|
{
|
||||||
LOG_ERROR("Internal error handling connection, can't find split point");
|
LOG_PRINT_L1("Internal error handling connection, can't find split point");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block_index_it == m_blocks_index.end())
|
if(block_index_it == m_blocks_index.end())
|
||||||
{
|
{
|
||||||
//this should NEVER happen, but, dose of paranoia in such cases is not too bad
|
//this should NEVER happen, but, dose of paranoia in such cases is not too bad
|
||||||
LOG_ERROR("Internal error handling connection, can't find split point");
|
LOG_PRINT_L1("Internal error handling connection, can't find split point");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1110,7 +1110,7 @@ void blockchain_storage::print_blockchain(uint64_t start_index, uint64_t end_ind
|
|||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
if(start_index >=m_blocks.size())
|
if(start_index >=m_blocks.size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Wrong starter index set: " << start_index << ", expected max index " << m_blocks.size()-1);
|
LOG_PRINT_L1("Wrong starter index set: " << start_index << ", expected max index " << m_blocks.size()-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,7 +1205,7 @@ bool blockchain_storage::add_block_as_invalid(const block_extended_info& bei, co
|
|||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
auto i_res = m_invalid_blocks.insert(std::map<crypto::hash, block_extended_info>::value_type(h, bei));
|
auto i_res = m_invalid_blocks.insert(std::map<crypto::hash, block_extended_info>::value_type(h, bei));
|
||||||
CHECK_AND_ASSERT_MES(i_res.second, false, "at insertion invalid by tx returned status existed");
|
CHECK_AND_ASSERT_MES(i_res.second, false, "at insertion invalid by tx returned status existed");
|
||||||
LOG_PRINT_L0("BLOCK ADDED AS INVALID: " << h << ENDL << ", prev_id=" << bei.bl.prev_id << ", m_invalid_blocks count=" << m_invalid_blocks.size());
|
LOG_PRINT_L1("BLOCK ADDED AS INVALID: " << h << ENDL << ", prev_id=" << bei.bl.prev_id << ", m_invalid_blocks count=" << m_invalid_blocks.size());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
@ -1306,7 +1306,7 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
|
|||||||
if(!r.second)
|
if(!r.second)
|
||||||
{
|
{
|
||||||
//double spend detected
|
//double spend detected
|
||||||
LOG_PRINT_L0("tx with id: " << m_tx_id << " in block id: " << m_bl_id << " have input marked as spent with key image: " << ki << ", block declined");
|
LOG_PRINT_L1("tx with id: " << m_tx_id << " in block id: " << m_bl_id << " has input marked as spent with key image: " << ki << ", block declined");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1321,7 +1321,7 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
|
|||||||
{
|
{
|
||||||
if(!boost::apply_visitor(add_transaction_input_visitor(m_spent_keys, tx_id, bl_id), in))
|
if(!boost::apply_visitor(add_transaction_input_visitor(m_spent_keys, tx_id, bl_id), in))
|
||||||
{
|
{
|
||||||
LOG_ERROR("critical internal error: add_transaction_input_visitor failed. but here key_images should be shecked");
|
LOG_PRINT_L1("critical internal error: add_transaction_input_visitor failed. but here key_images should be checked");
|
||||||
purge_transaction_keyimages_from_blockchain(tx, false);
|
purge_transaction_keyimages_from_blockchain(tx, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1332,7 +1332,7 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const
|
|||||||
auto i_r = m_transactions.insert(std::pair<crypto::hash, transaction_chain_entry>(tx_id, ch_e));
|
auto i_r = m_transactions.insert(std::pair<crypto::hash, transaction_chain_entry>(tx_id, ch_e));
|
||||||
if(!i_r.second)
|
if(!i_r.second)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("tx with id: " << tx_id << " in block id: " << bl_id << " already in blockchain");
|
LOG_PRINT_L1("tx with id: " << tx_id << " in block id: " << bl_id << " already in blockchain");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool r = push_transaction_to_global_outs_index(tx, tx_id, i_r.first->second.m_global_output_indexes);
|
bool r = push_transaction_to_global_outs_index(tx, tx_id, i_r.first->second.m_global_output_indexes);
|
||||||
@ -1349,7 +1349,7 @@ bool blockchain_storage::get_tx_outputs_gindexs(const crypto::hash& tx_id, std::
|
|||||||
auto it = m_transactions.find(tx_id);
|
auto it = m_transactions.find(tx_id);
|
||||||
if(it == m_transactions.end())
|
if(it == m_transactions.end())
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("warning: get_tx_outputs_gindexs failed to find transaction with id = " << tx_id);
|
LOG_PRINT_RED_L1("warning: get_tx_outputs_gindexs failed to find transaction with id = " << tx_id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1407,7 +1407,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
|
|||||||
CHECK_AND_ASSERT_MES(sig_index < tx.signatures.size(), false, "wrong transaction: not signature entry for input with index= " << sig_index);
|
CHECK_AND_ASSERT_MES(sig_index < tx.signatures.size(), false, "wrong transaction: not signature entry for input with index= " << sig_index);
|
||||||
if(!check_tx_input(in_to_key, tx_prefix_hash, tx.signatures[sig_index], pmax_used_block_height))
|
if(!check_tx_input(in_to_key, tx_prefix_hash, tx.signatures[sig_index], pmax_used_block_height))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to check ring signature for tx " << get_transaction_hash(tx));
|
LOG_PRINT_L1("Failed to check ring signature for tx " << get_transaction_hash(tx));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1453,13 +1453,13 @@ bool blockchain_storage::check_tx_input(const txin_to_key& txin, const crypto::h
|
|||||||
//check tx unlock time
|
//check tx unlock time
|
||||||
if(!m_bch.is_tx_spendtime_unlocked(tx.unlock_time))
|
if(!m_bch.is_tx_spendtime_unlocked(tx.unlock_time))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("One of outputs for one of inputs have wrong tx.unlock_time = " << tx.unlock_time);
|
LOG_PRINT_L1("One of outputs for one of inputs has wrong tx.unlock_time = " << tx.unlock_time);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(out.target.type() != typeid(txout_to_key))
|
if(out.target.type() != typeid(txout_to_key))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Output have wrong type id, which=" << out.target.which());
|
LOG_PRINT_L1("Output has wrong type id, which=" << out.target.which());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1473,13 +1473,13 @@ bool blockchain_storage::check_tx_input(const txin_to_key& txin, const crypto::h
|
|||||||
outputs_visitor vi(output_keys, *this);
|
outputs_visitor vi(output_keys, *this);
|
||||||
if(!scan_outputkeys_for_indexes(txin, vi, pmax_related_block_height))
|
if(!scan_outputkeys_for_indexes(txin, vi, pmax_related_block_height))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to get output keys for tx with amount = " << print_money(txin.amount) << " and count indexes " << txin.key_offsets.size());
|
LOG_PRINT_L1("Failed to get output keys for tx with amount = " << print_money(txin.amount) << " and count indexes " << txin.key_offsets.size());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(txin.key_offsets.size() != output_keys.size())
|
if(txin.key_offsets.size() != output_keys.size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Output keys for tx with amount = " << txin.amount << " and count indexes " << txin.key_offsets.size() << " returned wrong keys count " << output_keys.size());
|
LOG_PRINT_L1("Output keys for tx with amount = " << txin.amount << " and count indexes " << txin.key_offsets.size() << " returned wrong keys count " << output_keys.size());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CHECK_AND_ASSERT_MES(sig.size() == output_keys.size(), false, "internal error: tx signatures count=" << sig.size() << " mismatch with outputs keys count for inputs=" << output_keys.size());
|
CHECK_AND_ASSERT_MES(sig.size() == output_keys.size(), false, "internal error: tx signatures count=" << sig.size() << " mismatch with outputs keys count for inputs=" << output_keys.size());
|
||||||
@ -1498,7 +1498,7 @@ bool blockchain_storage::check_block_timestamp_main(const block& b)
|
|||||||
{
|
{
|
||||||
if(b.timestamp > get_adjusted_time() + CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT)
|
if(b.timestamp > get_adjusted_time() + CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", bigger than adjusted time + 2 hours");
|
LOG_PRINT_L1("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", bigger than adjusted time + 2 hours");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1519,7 +1519,7 @@ bool blockchain_storage::check_block_timestamp(std::vector<uint64_t> timestamps,
|
|||||||
|
|
||||||
if(b.timestamp < median_ts)
|
if(b.timestamp < median_ts)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", less than median of last " << BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW << " blocks, " << median_ts);
|
LOG_PRINT_L1("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", less than median of last " << BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW << " blocks, " << median_ts);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1532,16 +1532,16 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||||
if(bl.prev_id != get_tail_id())
|
if(bl.prev_id != get_tail_id())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << ENDL
|
LOG_PRINT_L1("Block with id: " << id << ENDL
|
||||||
<< "have wrong prev_id: " << bl.prev_id << ENDL
|
<< "has wrong prev_id: " << bl.prev_id << ENDL
|
||||||
<< "expected: " << get_tail_id());
|
<< "expected: " << get_tail_id());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_block_timestamp_main(bl))
|
if(!check_block_timestamp_main(bl))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << ENDL
|
LOG_PRINT_L1("Block with id: " << id << ENDL
|
||||||
<< "have invalid timestamp: " << bl.timestamp);
|
<< "has invalid timestamp: " << bl.timestamp);
|
||||||
//add_block_as_invalid(bl, id);//do not add blocks to invalid storage befor proof of work check was passed
|
//add_block_as_invalid(bl, id);//do not add blocks to invalid storage befor proof of work check was passed
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1565,9 +1565,9 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
|
|
||||||
if(!check_hash(proof_of_work, current_diffic))
|
if(!check_hash(proof_of_work, current_diffic))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << ENDL
|
LOG_PRINT_L1("Block with id: " << id << ENDL
|
||||||
<< "have not enough proof of work: " << proof_of_work << ENDL
|
<< "does not have enough proof of work: " << proof_of_work << ENDL
|
||||||
<< "nexpected difficulty: " << current_diffic );
|
<< "unexpected difficulty: " << current_diffic );
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1588,7 +1588,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
|
|
||||||
if(!prevalidate_miner_transaction(bl, m_blocks.size()))
|
if(!prevalidate_miner_transaction(bl, m_blocks.size()))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id
|
LOG_PRINT_L1("Block with id: " << id
|
||||||
<< " failed to pass prevalidation");
|
<< " failed to pass prevalidation");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1598,7 +1598,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
//process transactions
|
//process transactions
|
||||||
if(!add_transaction_from_block(bl.miner_tx, get_transaction_hash(bl.miner_tx), id, get_current_blockchain_height()))
|
if(!add_transaction_from_block(bl.miner_tx, get_transaction_hash(bl.miner_tx), id, get_current_blockchain_height()))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << " failed to add transaction to blockchain storage");
|
LOG_PRINT_L1("Block with id: " << id << " failed to add transaction to blockchain storage");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1611,7 +1611,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
uint64_t fee = 0;
|
uint64_t fee = 0;
|
||||||
if(!m_tx_pool.take_tx(tx_id, tx, blob_size, fee))
|
if(!m_tx_pool.take_tx(tx_id, tx, blob_size, fee))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << "have at least one unknown transaction with id: " << tx_id);
|
LOG_PRINT_L1("Block with id: " << id << "has at least one unknown transaction with id: " << tx_id);
|
||||||
purge_block_data_from_blockchain(bl, tx_processed_count);
|
purge_block_data_from_blockchain(bl, tx_processed_count);
|
||||||
//add_block_as_invalid(bl, id);
|
//add_block_as_invalid(bl, id);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
@ -1619,20 +1619,20 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
}
|
}
|
||||||
if(!check_tx_inputs(tx))
|
if(!check_tx_inputs(tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << "have at least one transaction (id: " << tx_id << ") with wrong inputs.");
|
LOG_PRINT_L1("Block with id: " << id << "has at least one transaction (id: " << tx_id << ") with wrong inputs.");
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
bool add_res = m_tx_pool.add_tx(tx, tvc, true);
|
bool add_res = m_tx_pool.add_tx(tx, tvc, true);
|
||||||
CHECK_AND_ASSERT_MES2(add_res, "handle_block_to_main_chain: failed to add transaction back to transaction pool");
|
CHECK_AND_ASSERT_MES2(add_res, "handle_block_to_main_chain: failed to add transaction back to transaction pool");
|
||||||
purge_block_data_from_blockchain(bl, tx_processed_count);
|
purge_block_data_from_blockchain(bl, tx_processed_count);
|
||||||
add_block_as_invalid(bl, id);
|
add_block_as_invalid(bl, id);
|
||||||
LOG_PRINT_L0("Block with id " << id << " added as invalid becouse of wrong inputs in transactions");
|
LOG_PRINT_L1("Block with id " << id << " added as invalid becouse of wrong inputs in transactions");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!add_transaction_from_block(tx, tx_id, id, get_current_blockchain_height()))
|
if(!add_transaction_from_block(tx, tx_id, id, get_current_blockchain_height()))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id << " failed to add transaction to blockchain storage");
|
LOG_PRINT_L1("Block with id: " << id << " failed to add transaction to blockchain storage");
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
bool add_res = m_tx_pool.add_tx(tx, tvc, true);
|
bool add_res = m_tx_pool.add_tx(tx, tvc, true);
|
||||||
CHECK_AND_ASSERT_MES2(add_res, "handle_block_to_main_chain: failed to add transaction back to transaction pool");
|
CHECK_AND_ASSERT_MES2(add_res, "handle_block_to_main_chain: failed to add transaction back to transaction pool");
|
||||||
@ -1648,8 +1648,8 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
uint64_t already_generated_coins = m_blocks.size() ? m_blocks.back().already_generated_coins:0;
|
uint64_t already_generated_coins = m_blocks.size() ? m_blocks.back().already_generated_coins:0;
|
||||||
if(!validate_miner_transaction(bl, cumulative_block_size, fee_summary, base_reward, already_generated_coins))
|
if(!validate_miner_transaction(bl, cumulative_block_size, fee_summary, base_reward, already_generated_coins))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block with id: " << id
|
LOG_PRINT_L1("Block with id: " << id
|
||||||
<< " have wrong miner transaction");
|
<< " has incorrect miner transaction");
|
||||||
purge_block_data_from_blockchain(bl, tx_processed_count);
|
purge_block_data_from_blockchain(bl, tx_processed_count);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
@ -1669,7 +1669,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||||||
auto ind_res = m_blocks_index.insert(std::pair<crypto::hash, size_t>(id, bei.height));
|
auto ind_res = m_blocks_index.insert(std::pair<crypto::hash, size_t>(id, bei.height));
|
||||||
if(!ind_res.second)
|
if(!ind_res.second)
|
||||||
{
|
{
|
||||||
LOG_ERROR("block with id: " << id << " already in block indexes");
|
LOG_PRINT_L1("block with id: " << id << " already in block indexes");
|
||||||
purge_block_data_from_blockchain(bl, tx_processed_count);
|
purge_block_data_from_blockchain(bl, tx_processed_count);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,7 +159,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
if(tx_blob.size() > get_max_tx_size())
|
if(tx_blob.size() > get_max_tx_size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("WRONG TRANSACTION BLOB, too big size " << tx_blob.size() << ", rejected");
|
LOG_PRINT_L1("WRONG TRANSACTION BLOB, too big size " << tx_blob.size() << ", rejected");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
if(!parse_tx_from_blob(tx, tx_hash, tx_prefixt_hash, tx_blob))
|
if(!parse_tx_from_blob(tx, tx_hash, tx_prefixt_hash, tx_blob))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("WRONG TRANSACTION BLOB, Failed to parse, rejected");
|
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to parse, rejected");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -178,23 +178,23 @@ namespace cryptonote
|
|||||||
|
|
||||||
if(!check_tx_syntax(tx))
|
if(!check_tx_syntax(tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " syntax, rejected");
|
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " syntax, rejected");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_tx_semantic(tx, keeped_by_block))
|
if(!check_tx_semantic(tx, keeped_by_block))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected");
|
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool r = add_new_tx(tx, tx_hash, tx_prefixt_hash, tx_blob.size(), tvc, keeped_by_block);
|
bool r = add_new_tx(tx, tx_hash, tx_prefixt_hash, tx_blob.size(), tvc, keeped_by_block);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{LOG_PRINT_RED_L0("Transaction verification failed: " << tx_hash);}
|
{LOG_PRINT_RED_L1("Transaction verification failed: " << tx_hash);}
|
||||||
else if(tvc.m_verifivation_impossible)
|
else if(tvc.m_verifivation_impossible)
|
||||||
{LOG_PRINT_RED_L0("Transaction verification impossible: " << tx_hash);}
|
{LOG_PRINT_RED_L1("Transaction verification impossible: " << tx_hash);}
|
||||||
|
|
||||||
if(tvc.m_added_to_pool)
|
if(tvc.m_added_to_pool)
|
||||||
LOG_PRINT_L1("tx added: " << tx_hash);
|
LOG_PRINT_L1("tx added: " << tx_hash);
|
||||||
@ -216,25 +216,25 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
if(!tx.vin.size())
|
if(!tx.vin.size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("tx with empty inputs, rejected for tx id= " << get_transaction_hash(tx));
|
LOG_PRINT_RED_L1("tx with empty inputs, rejected for tx id= " << get_transaction_hash(tx));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_inputs_types_supported(tx))
|
if(!check_inputs_types_supported(tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("unsupported input types for tx id= " << get_transaction_hash(tx));
|
LOG_PRINT_RED_L1("unsupported input types for tx id= " << get_transaction_hash(tx));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_outs_valid(tx))
|
if(!check_outs_valid(tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("tx with invalid outputs, rejected for tx id= " << get_transaction_hash(tx));
|
LOG_PRINT_RED_L1("tx with invalid outputs, rejected for tx id= " << get_transaction_hash(tx));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_money_overflow(tx))
|
if(!check_money_overflow(tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("tx have money overflow, rejected for tx id= " << get_transaction_hash(tx));
|
LOG_PRINT_RED_L1("tx has money overflow, rejected for tx id= " << get_transaction_hash(tx));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,20 +244,20 @@ namespace cryptonote
|
|||||||
|
|
||||||
if(amount_in <= amount_out)
|
if(amount_in <= amount_out)
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("tx with wrong amounts: ins " << amount_in << ", outs " << amount_out << ", rejected for tx id= " << get_transaction_hash(tx));
|
LOG_PRINT_RED_L1("tx with wrong amounts: ins " << amount_in << ", outs " << amount_out << ", rejected for tx id= " << get_transaction_hash(tx));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keeped_by_block && get_object_blobsize(tx) >= m_blockchain_storage.get_current_comulative_blocksize_limit() - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE)
|
if(!keeped_by_block && get_object_blobsize(tx) >= m_blockchain_storage.get_current_comulative_blocksize_limit() - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE)
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("tx have to big size " << get_object_blobsize(tx) << ", expected not bigger than " << m_blockchain_storage.get_current_comulative_blocksize_limit() - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
|
LOG_PRINT_RED_L1("tx is too large " << get_object_blobsize(tx) << ", expected not bigger than " << m_blockchain_storage.get_current_comulative_blocksize_limit() - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if tx use different key images
|
//check if tx use different key images
|
||||||
if(!check_tx_inputs_keyimages_diff(tx))
|
if(!check_tx_inputs_keyimages_diff(tx))
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("tx have to big size " << get_object_blobsize(tx) << ", expected not bigger than " << m_blockchain_storage.get_current_comulative_blocksize_limit() - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
|
LOG_PRINT_RED_L1("tx is too large " << get_object_blobsize(tx) << ", expected not bigger than " << m_blockchain_storage.get_current_comulative_blocksize_limit() - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ namespace cryptonote
|
|||||||
m_blockchain_storage.get_transactions(b.tx_hashes, txs, missed_txs);
|
m_blockchain_storage.get_transactions(b.tx_hashes, txs, missed_txs);
|
||||||
if(missed_txs.size() && m_blockchain_storage.get_block_id_by_height(get_block_height(b)) != get_block_hash(b))
|
if(missed_txs.size() && m_blockchain_storage.get_block_id_by_height(get_block_height(b)) != get_block_hash(b))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Block found but, seems that reorganize just happened after that, do not relay this block");
|
LOG_PRINT_L1("Block found but, seems that reorganize just happened after that, do not relay this block");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
CHECK_AND_ASSERT_MES(txs.size() == b.tx_hashes.size() && !missed_txs.size(), false, "cant find some transactions in found block:" << get_block_hash(b) << " txs.size()=" << txs.size()
|
CHECK_AND_ASSERT_MES(txs.size() == b.tx_hashes.size() && !missed_txs.size(), false, "cant find some transactions in found block:" << get_block_hash(b) << " txs.size()=" << txs.size()
|
||||||
@ -420,7 +420,7 @@ namespace cryptonote
|
|||||||
bvc = boost::value_initialized<block_verification_context>();
|
bvc = boost::value_initialized<block_verification_context>();
|
||||||
if(block_blob.size() > get_max_block_size())
|
if(block_blob.size() > get_max_block_size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("WRONG BLOCK BLOB, too big size " << block_blob.size() << ", rejected");
|
LOG_PRINT_L1("WRONG BLOCK BLOB, too big size " << block_blob.size() << ", rejected");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ namespace cryptonote
|
|||||||
block b = AUTO_VAL_INIT(b);
|
block b = AUTO_VAL_INIT(b);
|
||||||
if(!parse_and_validate_block_from_blob(block_blob, b))
|
if(!parse_and_validate_block_from_blob(block_blob, b))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to parse and validate new block");
|
LOG_PRINT_L1("Failed to parse and validate new block");
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -444,7 +444,7 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
if(block_blob.size() > get_max_block_size())
|
if(block_blob.size() > get_max_block_size())
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("WRONG BLOCK BLOB, too big size " << block_blob.size() << ", rejected");
|
LOG_PRINT_L1("WRONG BLOCK BLOB, too big size " << block_blob.size() << ", rejected");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -80,7 +80,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
if(outputs_amount >= inputs_amount)
|
if(outputs_amount >= inputs_amount)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("transaction use more money then it has: use " << print_money(outputs_amount) << ", have " << print_money(inputs_amount));
|
LOG_PRINT_L1("transaction use more money then it has: use " << print_money(outputs_amount) << ", have " << print_money(inputs_amount));
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -88,14 +88,14 @@ namespace cryptonote
|
|||||||
uint64_t fee = inputs_amount - outputs_amount;
|
uint64_t fee = inputs_amount - outputs_amount;
|
||||||
if (!kept_by_block && fee < DEFAULT_FEE)
|
if (!kept_by_block && fee < DEFAULT_FEE)
|
||||||
{
|
{
|
||||||
LOG_ERROR("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(DEFAULT_FEE));
|
LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(DEFAULT_FEE));
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!kept_by_block && blob_size >= TRANSACTION_SIZE_LIMIT)
|
if (!kept_by_block && blob_size >= TRANSACTION_SIZE_LIMIT)
|
||||||
{
|
{
|
||||||
LOG_ERROR("transaction is too big: " << blob_size << " bytes, maximum size: " << TRANSACTION_SIZE_LIMIT);
|
LOG_PRINT_L1("transaction is too big: " << blob_size << " bytes, maximum size: " << TRANSACTION_SIZE_LIMIT);
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
if(have_tx_keyimges_as_spent(tx))
|
if(have_tx_keyimges_as_spent(tx))
|
||||||
{
|
{
|
||||||
LOG_ERROR("Transaction with id= "<< id << " used already spent key images");
|
LOG_PRINT_L1("Transaction with id= "<< id << " used already spent key images");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ namespace cryptonote
|
|||||||
tvc.m_added_to_pool = true;
|
tvc.m_added_to_pool = true;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("tx used wrong inputs, rejected");
|
LOG_PRINT_L1("tx used wrong inputs, rejected");
|
||||||
tvc.m_verifivation_failed = true;
|
tvc.m_verifivation_failed = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -242,7 +242,7 @@ namespace cryptonote
|
|||||||
if((tx_age > CRYPTONOTE_MEMPOOL_TX_LIVETIME && !it->second.kept_by_block) ||
|
if((tx_age > CRYPTONOTE_MEMPOOL_TX_LIVETIME && !it->second.kept_by_block) ||
|
||||||
(tx_age > CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME && it->second.kept_by_block) )
|
(tx_age > CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME && it->second.kept_by_block) )
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Tx " << it->first << " removed from tx pool due to outdated, age: " << tx_age );
|
LOG_PRINT_L1("Tx " << it->first << " removed from tx pool due to outdated, age: " << tx_age );
|
||||||
m_transactions.erase(it++);
|
m_transactions.erase(it++);
|
||||||
}else
|
}else
|
||||||
++it;
|
++it;
|
||||||
@ -467,7 +467,7 @@ namespace cryptonote
|
|||||||
bool res = tools::unserialize_obj_from_file(*this, state_file_path);
|
bool res = tools::unserialize_obj_from_file(*this, state_file_path);
|
||||||
if(!res)
|
if(!res)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Failed to load memory pool from file " << state_file_path);
|
LOG_PRINT_L1("Failed to load memory pool from file " << state_file_path);
|
||||||
|
|
||||||
m_transactions.clear();
|
m_transactions.clear();
|
||||||
m_spent_key_images.clear();
|
m_spent_key_images.clear();
|
||||||
@ -476,7 +476,7 @@ namespace cryptonote
|
|||||||
for (auto it = m_transactions.begin(); it != m_transactions.end(); ) {
|
for (auto it = m_transactions.begin(); it != m_transactions.end(); ) {
|
||||||
auto it2 = it++;
|
auto it2 = it++;
|
||||||
if (it2->second.blob_size >= TRANSACTION_SIZE_LIMIT) {
|
if (it2->second.blob_size >= TRANSACTION_SIZE_LIMIT) {
|
||||||
LOG_PRINT_L0("Transaction " << get_transaction_hash(it2->second.tx) << " is too big (" << it2->second.blob_size << " bytes), removing it from pool");
|
LOG_PRINT_L1("Transaction " << get_transaction_hash(it2->second.tx) << " is too big (" << it2->second.blob_size << " bytes), removing it from pool");
|
||||||
remove_transaction_keyimages(it2->second.tx);
|
remove_transaction_keyimages(it2->second.tx);
|
||||||
m_transactions.erase(it2);
|
m_transactions.erase(it2);
|
||||||
}
|
}
|
||||||
@ -491,7 +491,7 @@ namespace cryptonote
|
|||||||
{
|
{
|
||||||
if (!tools::create_directories_if_necessary(m_config_folder))
|
if (!tools::create_directories_if_necessary(m_config_folder))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to create data directory: " << m_config_folder);
|
LOG_PRINT_L1("Failed to create data directory: " << m_config_folder);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +499,7 @@ namespace cryptonote
|
|||||||
bool res = tools::serialize_obj_to_file(*this, state_file_path);
|
bool res = tools::serialize_obj_to_file(*this, state_file_path);
|
||||||
if(!res)
|
if(!res)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to serialize memory pool to file " << state_file_path);
|
LOG_PRINT_L1("Failed to serialize memory pool to file " << state_file_path);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ namespace cryptonote
|
|||||||
m_core.handle_incoming_tx(*tx_blob_it, tvc, true);
|
m_core.handle_incoming_tx(*tx_blob_it, tvc, true);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L0("Block verification failed: transaction verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Block verification failed: transaction verification failed, dropping connection");
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -238,7 +238,7 @@ namespace cryptonote
|
|||||||
m_core.resume_mine();
|
m_core.resume_mine();
|
||||||
if(bvc.m_verifivation_failed)
|
if(bvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L0("Block verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Block verification failed, dropping connection");
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ namespace cryptonote
|
|||||||
m_core.handle_incoming_tx(*tx_blob_it, tvc, false);
|
m_core.handle_incoming_tx(*tx_blob_it, tvc, false);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L0("Tx verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Tx verification failed, dropping connection");
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -404,13 +404,13 @@ namespace cryptonote
|
|||||||
|
|
||||||
if(bvc.m_verifivation_failed)
|
if(bvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L0("Block verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Block verification failed, dropping connection");
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(bvc.m_marked_as_orphaned)
|
if(bvc.m_marked_as_orphaned)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L0("Block received at sync phase was marked as orphaned, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Block received at sync phase was marked as orphaned, dropping connection");
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -169,20 +169,20 @@ int main(int argc, char* argv[])
|
|||||||
daemon_cmmands_handler dch(p2psrv);
|
daemon_cmmands_handler dch(p2psrv);
|
||||||
|
|
||||||
//initialize objects
|
//initialize objects
|
||||||
LOG_PRINT_L0("Initializing p2p server...");
|
LOG_PRINT_L0("Initializing P2P server...");
|
||||||
res = p2psrv.init(vm);
|
res = p2psrv.init(vm);
|
||||||
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize p2p server.");
|
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize P2P server.");
|
||||||
LOG_PRINT_L0("P2p server initialized OK");
|
LOG_PRINT_L0("P2P server initialized OK");
|
||||||
|
|
||||||
LOG_PRINT_L0("Initializing cryptonote protocol...");
|
LOG_PRINT_L0("Initializing protocol...");
|
||||||
res = cprotocol.init(vm);
|
res = cprotocol.init(vm);
|
||||||
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize cryptonote protocol.");
|
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize protocol.");
|
||||||
LOG_PRINT_L0("Cryptonote protocol initialized OK");
|
LOG_PRINT_L0("Protocol initialized OK");
|
||||||
|
|
||||||
LOG_PRINT_L0("Initializing core rpc server...");
|
LOG_PRINT_L0("Initializing core RPC server...");
|
||||||
res = rpc_server.init(vm);
|
res = rpc_server.init(vm);
|
||||||
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize core rpc server.");
|
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize core RPC server.");
|
||||||
LOG_PRINT_GREEN("Core rpc server initialized OK on port: " << rpc_server.get_binded_port(), LOG_LEVEL_0);
|
LOG_PRINT_GREEN("Core RPC server initialized OK on port: " << rpc_server.get_binded_port(), LOG_LEVEL_0);
|
||||||
|
|
||||||
//initialize core here
|
//initialize core here
|
||||||
LOG_PRINT_L0("Initializing core...");
|
LOG_PRINT_L0("Initializing core...");
|
||||||
@ -196,19 +196,19 @@ int main(int argc, char* argv[])
|
|||||||
dch.start_handling();
|
dch.start_handling();
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_PRINT_L0("Starting core rpc server...");
|
LOG_PRINT_L0("Starting core RPC server...");
|
||||||
res = rpc_server.run(2, false);
|
res = rpc_server.run(2, false);
|
||||||
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize core rpc server.");
|
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize core RPC server.");
|
||||||
LOG_PRINT_L0("Core rpc server started ok");
|
LOG_PRINT_L0("Core RPC server started ok");
|
||||||
|
|
||||||
tools::signal_handler::install([&dch, &p2psrv] {
|
tools::signal_handler::install([&dch, &p2psrv] {
|
||||||
dch.stop_handling();
|
dch.stop_handling();
|
||||||
p2psrv.send_stop_signal();
|
p2psrv.send_stop_signal();
|
||||||
});
|
});
|
||||||
|
|
||||||
LOG_PRINT_L0("Starting p2p net loop...");
|
LOG_PRINT_L0("Starting P2P net loop...");
|
||||||
p2psrv.run();
|
p2psrv.run();
|
||||||
LOG_PRINT_L0("p2p net loop stopped");
|
LOG_PRINT_L0("P2P net loop stopped");
|
||||||
|
|
||||||
//stop components
|
//stop components
|
||||||
LOG_PRINT_L0("Stopping core rpc server...");
|
LOG_PRINT_L0("Stopping core rpc server...");
|
||||||
@ -218,11 +218,11 @@ int main(int argc, char* argv[])
|
|||||||
//deinitialize components
|
//deinitialize components
|
||||||
LOG_PRINT_L0("Deinitializing core...");
|
LOG_PRINT_L0("Deinitializing core...");
|
||||||
ccore.deinit();
|
ccore.deinit();
|
||||||
LOG_PRINT_L0("Deinitializing rpc server ...");
|
LOG_PRINT_L0("Deinitializing RPC server ...");
|
||||||
rpc_server.deinit();
|
rpc_server.deinit();
|
||||||
LOG_PRINT_L0("Deinitializing cryptonote_protocol...");
|
LOG_PRINT_L0("Deinitializing protocol...");
|
||||||
cprotocol.deinit();
|
cprotocol.deinit();
|
||||||
LOG_PRINT_L0("Deinitializing p2p...");
|
LOG_PRINT_L0("Deinitializing P2P...");
|
||||||
p2psrv.deinit();
|
p2psrv.deinit();
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,8 +42,15 @@
|
|||||||
#include "net/local_ip.h"
|
#include "net/local_ip.h"
|
||||||
#include "crypto/crypto.h"
|
#include "crypto/crypto.h"
|
||||||
#include "storages/levin_abstract_invoke2.h"
|
#include "storages/levin_abstract_invoke2.h"
|
||||||
#include <miniupnpc/miniupnpc.h>
|
|
||||||
#include <miniupnpc/upnpcommands.h>
|
// We have to look for miniupnpc headers in different places, dependent on if its compiled or external
|
||||||
|
#ifdef UPNP_STATIC
|
||||||
|
#include <miniupnpc/miniupnpc.h>
|
||||||
|
#include <miniupnpc/upnpcommands.h>
|
||||||
|
#else
|
||||||
|
#include "miniupnpc.h"
|
||||||
|
#include "upnpcommands.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NET_MAKE_IP(b1,b2,b3,b4) ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
|
#define NET_MAKE_IP(b1,b2,b3,b4) ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))
|
||||||
|
|
||||||
@ -261,7 +268,7 @@ namespace nodetool
|
|||||||
CHECK_AND_ASSERT_MES(res, false, "Failed to bind server");
|
CHECK_AND_ASSERT_MES(res, false, "Failed to bind server");
|
||||||
|
|
||||||
m_listenning_port = m_net_server.get_binded_port();
|
m_listenning_port = m_net_server.get_binded_port();
|
||||||
LOG_PRINT_GREEN("Net service binded on " << m_bind_ip << ":" << m_listenning_port, LOG_LEVEL_0);
|
LOG_PRINT_GREEN("Net service bound to " << m_bind_ip << ":" << m_listenning_port, LOG_LEVEL_0);
|
||||||
if(m_external_port)
|
if(m_external_port)
|
||||||
LOG_PRINT_L0("External port defined as " << m_external_port);
|
LOG_PRINT_L0("External port defined as " << m_external_port);
|
||||||
|
|
||||||
@ -541,7 +548,7 @@ namespace nodetool
|
|||||||
#define LOG_PRINT_CC_PRIORITY_NODE(priority, con, msg) \
|
#define LOG_PRINT_CC_PRIORITY_NODE(priority, con, msg) \
|
||||||
do { \
|
do { \
|
||||||
if (priority) {\
|
if (priority) {\
|
||||||
LOG_PRINT_CC_L0(con, msg); \
|
LOG_PRINT_CC_L1(con, msg); \
|
||||||
} else {\
|
} else {\
|
||||||
LOG_PRINT_CC_L1(con, msg); \
|
LOG_PRINT_CC_L1(con, msg); \
|
||||||
} \
|
} \
|
||||||
@ -780,7 +787,7 @@ namespace nodetool
|
|||||||
{
|
{
|
||||||
if(be.last_seen > local_time)
|
if(be.last_seen > local_time)
|
||||||
{
|
{
|
||||||
LOG_PRINT_RED_L0("FOUND FUTURE peerlist for entry " << epee::string_tools::get_ip_string_from_int32(be.adr.ip) << ":" << be.adr.port << " last_seen: " << be.last_seen << ", local_time(on remote node):" << local_time);
|
LOG_PRINT_RED_L1("FOUND FUTURE peerlist for entry " << epee::string_tools::get_ip_string_from_int32(be.adr.ip) << ":" << be.adr.port << " last_seen: " << be.last_seen << ", local_time(on remote node):" << local_time);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
be.last_seen += delta;
|
be.last_seen += delta;
|
||||||
@ -1034,7 +1041,7 @@ namespace nodetool
|
|||||||
if(arg.node_data.network_id != MONERO_NETWORK)
|
if(arg.node_data.network_id != MONERO_NETWORK)
|
||||||
{
|
{
|
||||||
|
|
||||||
LOG_PRINT_CCONTEXT_L0("WRONG NETWORK AGENT CONNECTED! id=" << epee::string_tools::get_str_from_guid_a(arg.node_data.network_id));
|
LOG_PRINT_CCONTEXT_L1("WRONG NETWORK AGENT CONNECTED! id=" << epee::string_tools::get_str_from_guid_a(arg.node_data.network_id));
|
||||||
drop_connection(context);
|
drop_connection(context);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,33 @@
|
|||||||
|
# Copyright (c) 2014, The Monero Project
|
||||||
|
#
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
# permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
# conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
# of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
# materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without specific
|
||||||
|
# prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
add_definitions(-DSTATICLIB)
|
add_definitions(-DSTATICLIB)
|
||||||
|
|
||||||
add_subdirectory(gtest)
|
add_subdirectory(gtest)
|
||||||
@ -31,7 +61,7 @@ add_executable(unit_tests ${UNIT_TESTS})
|
|||||||
add_executable(net_load_tests_clt net_load_tests/clt.cpp)
|
add_executable(net_load_tests_clt net_load_tests/clt.cpp)
|
||||||
add_executable(net_load_tests_srv net_load_tests/srv.cpp)
|
add_executable(net_load_tests_srv net_load_tests/srv.cpp)
|
||||||
|
|
||||||
target_link_libraries(core_proxy cryptonote_core common crypto upnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(core_proxy cryptonote_core common crypto ${UPNP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
target_link_libraries(coretests cryptonote_core common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(coretests cryptonote_core common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
target_link_libraries(difficulty-tests cryptonote_core)
|
target_link_libraries(difficulty-tests cryptonote_core)
|
||||||
target_link_libraries(functional_tests cryptonote_core wallet common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
target_link_libraries(functional_tests cryptonote_core wallet common crypto ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||||
|
@ -44,7 +44,11 @@
|
|||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# include <signal.h>
|
||||||
#endif // GTEST_OS_LINUX
|
#endif // GTEST_OS_LINUX
|
||||||
|
#if GTEST_CAN_STREAM_RESULTS_
|
||||||
|
# include <sys/socket.h>
|
||||||
|
#endif // GTEST_CAN_STREAM_RESULTS_
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -188,6 +188,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
@ -232,6 +233,9 @@
|
|||||||
# ifdef ANDROID
|
# ifdef ANDROID
|
||||||
# define GTEST_OS_LINUX_ANDROID 1
|
# define GTEST_OS_LINUX_ANDROID 1
|
||||||
# endif // ANDROID
|
# endif // ANDROID
|
||||||
|
#elif defined __FreeBSD__
|
||||||
|
# define GTEST_OS_LINUX 1
|
||||||
|
# define GTEST_HAS_CLONE 0
|
||||||
#elif defined __MVS__
|
#elif defined __MVS__
|
||||||
# define GTEST_OS_ZOS 1
|
# define GTEST_OS_ZOS 1
|
||||||
#elif defined(__sun) && defined(__SVR4)
|
#elif defined(__sun) && defined(__SVR4)
|
||||||
@ -449,7 +453,7 @@
|
|||||||
// defining __GNUC__ and friends, but cannot compile GCC's tuple
|
// defining __GNUC__ and friends, but cannot compile GCC's tuple
|
||||||
// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
|
// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
|
||||||
// Feature Pack download, which we cannot assume the user has.
|
// Feature Pack download, which we cannot assume the user has.
|
||||||
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
|
# if (defined(__GNUC__) && !defined(__CUDACC__) && !defined(_LIBCPP_VERSION) && (GTEST_GCC_VER_ >= 40000)) \
|
||||||
|| _MSC_VER >= 1600
|
|| _MSC_VER >= 1600
|
||||||
# define GTEST_USE_OWN_TR1_TUPLE 0
|
# define GTEST_USE_OWN_TR1_TUPLE 0
|
||||||
# else
|
# else
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
void set_process_affinity(int core)
|
void set_process_affinity(int core)
|
||||||
{
|
{
|
||||||
#if defined (__APPLE__)
|
#if defined (__APPLE__) || defined(__FreeBSD__)
|
||||||
return;
|
return;
|
||||||
#elif defined(BOOST_WINDOWS)
|
#elif defined(BOOST_WINDOWS)
|
||||||
DWORD_PTR mask = 1;
|
DWORD_PTR mask = 1;
|
||||||
@ -62,7 +62,7 @@ void set_process_affinity(int core)
|
|||||||
|
|
||||||
void set_thread_high_priority()
|
void set_thread_high_priority()
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
return;
|
return;
|
||||||
#elif defined(BOOST_WINDOWS)
|
#elif defined(BOOST_WINDOWS)
|
||||||
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
||||||
|
Loading…
Reference in New Issue
Block a user