forked from such-gitea/wownero
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e302be710 | ||
|
|
b4ea97713d | ||
|
|
3e5fbb4fec | ||
|
|
178f454742 | ||
|
|
345be3361e | ||
|
|
5ad6661274 | ||
|
|
cd1de16fc2 | ||
|
|
c9d4dd1082 | ||
|
|
7d44e42dde | ||
|
|
6481a9ba5e | ||
|
|
e5dc1f749f | ||
|
|
7d01e5fa30 | ||
|
|
f603c70a5f | ||
|
|
d807ab95f1 | ||
|
|
b79968a7d8 | ||
|
|
c7fc4993cb | ||
|
|
4b4882082e | ||
|
|
2f7d418bda | ||
|
|
2d01af02ef | ||
|
|
1ff387c933 | ||
|
|
054abe1fa4 | ||
|
|
d6e7550793 | ||
|
|
194b88bf4f | ||
|
|
50c24fb1bb | ||
|
|
60386e7cf4 | ||
|
|
ff0fb4b6ed |
@@ -644,7 +644,7 @@ function (monero_add_library name)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function (monero_add_library_with_deps)
|
function (monero_add_library_with_deps)
|
||||||
cmake_parse_arguments(MONERO_ADD_LIBRARY "" "NAME" "DEPENDS;LINKS;PRIVATE_LINKS;INCLUDES;PRIVATE_INCLUDES;SOURCES" ${ARGN})
|
cmake_parse_arguments(MONERO_ADD_LIBRARY "" "NAME" "DEPENDS;SOURCES" ${ARGN})
|
||||||
source_group("${MONERO_ADD_LIBRARY_NAME}" FILES ${MONERO_ADD_LIBRARY_SOURCES})
|
source_group("${MONERO_ADD_LIBRARY_NAME}" FILES ${MONERO_ADD_LIBRARY_SOURCES})
|
||||||
|
|
||||||
# Define a ("virtual") object library and an actual library that links those
|
# Define a ("virtual") object library and an actual library that links those
|
||||||
@@ -659,22 +659,6 @@ function (monero_add_library_with_deps)
|
|||||||
if (MONERO_ADD_LIBRARY_DEPENDS)
|
if (MONERO_ADD_LIBRARY_DEPENDS)
|
||||||
add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS})
|
add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS})
|
||||||
endif()
|
endif()
|
||||||
if (MONERO_ADD_LIBRARY_LINKS)
|
|
||||||
target_link_libraries(${objlib} PUBLIC ${MONERO_ADD_LIBRARY_LINKS})
|
|
||||||
target_link_libraries(${MONERO_ADD_LIBRARY_NAME} PUBLIC ${MONERO_ADD_LIBRARY_LINKS})
|
|
||||||
endif()
|
|
||||||
if (MONERO_ADD_LIBRARY_PRIVATE_LINKS)
|
|
||||||
target_link_libraries(${objlib} PRIVATE ${MONERO_ADD_LIBRARY_PRIVATE_LINKS})
|
|
||||||
target_link_libraries(${MONERO_ADD_LIBRARY_NAME} PRIVATE ${MONERO_ADD_LIBRARY_PRIVATE_LINKS})
|
|
||||||
endif()
|
|
||||||
if (MONERO_ADD_LIBRARY_INCLUDES)
|
|
||||||
target_include_directories(${objlib} PUBLIC ${MONERO_ADD_LIBRARY_INCLUDES})
|
|
||||||
target_include_directories(${MONERO_ADD_LIBRARY_NAME} PUBLIC ${MONERO_ADD_LIBRARY_INCLUDES})
|
|
||||||
endif()
|
|
||||||
if (MONERO_ADD_LIBRARY_PRIVATE_INCLUDES)
|
|
||||||
target_include_directories(${objlib} PRIVATE ${MONERO_ADD_LIBRARY_PRIVATE_INCLUDES})
|
|
||||||
target_include_directories(${MONERO_ADD_LIBRARY_NAME} PRIVATE ${MONERO_ADD_LIBRARY_PRIVATE_INCLUDES})
|
|
||||||
endif()
|
|
||||||
set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs")
|
set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs")
|
||||||
target_compile_definitions(${objlib}
|
target_compile_definitions(${objlib}
|
||||||
PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>)
|
PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>)
|
||||||
@@ -1092,29 +1076,39 @@ if(STATIC)
|
|||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
set(Boost_USE_STATIC_RUNTIME ON)
|
set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
endif()
|
endif()
|
||||||
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale)
|
|
||||||
|
# Find Boost headers
|
||||||
|
set(BOOST_MIN_VER 1.62)
|
||||||
|
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED)
|
||||||
|
|
||||||
|
if(NOT Boost_FOUND)
|
||||||
|
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=${BOOST_MIN_VER}) or the equivalent")
|
||||||
|
elseif(Boost_FOUND)
|
||||||
|
message(STATUS "Found Boost Version: ${Boost_VERSION_STRING}")
|
||||||
|
|
||||||
|
set(BOOST_COMPONENTS filesystem thread date_time chrono serialization program_options locale)
|
||||||
|
|
||||||
|
# Boost System is header-only since 1.69
|
||||||
|
if (Boost_VERSION_STRING VERSION_LESS 1.69.0)
|
||||||
|
list(APPEND BOOST_COMPONENTS system)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Boost Regex is header-only since 1.77
|
||||||
|
if (Boost_VERSION_STRING VERSION_LESS 1.77.0)
|
||||||
|
list(APPEND BOOST_COMPONENTS regex)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Boost components: ${BOOST_COMPONENTS}")
|
||||||
|
|
||||||
|
# Find required Boost libraries
|
||||||
|
find_package(Boost ${BOOST_MIN_VER} QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
|
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
|
||||||
add_definitions(-DBOOST_NO_AUTO_PTR)
|
add_definitions(-DBOOST_NO_AUTO_PTR)
|
||||||
add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
|
add_definitions(-DBOOST_UUID_DISABLE_ALIGNMENT) # This restores UUID's std::has_unique_object_representations property
|
||||||
|
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
|
|
||||||
if(NOT Boost_FOUND)
|
|
||||||
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (>=1.58) or the equivalent")
|
|
||||||
elseif(Boost_FOUND)
|
|
||||||
message(STATUS "Found Boost Version: ${Boost_VERSION}")
|
|
||||||
if (Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 1.62.0 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
|
|
||||||
set(BOOST_BEFORE_1_62 true)
|
|
||||||
endif()
|
|
||||||
if (NOT Boost_VERSION VERSION_LESS 10 AND Boost_VERSION VERSION_LESS 106200 AND NOT (OPENSSL_VERSION VERSION_LESS 1.1))
|
|
||||||
set(BOOST_BEFORE_1_62 true)
|
|
||||||
endif()
|
|
||||||
if (BOOST_BEFORE_1_62)
|
|
||||||
message(FATAL_ERROR "Boost ${Boost_VERSION} (older than 1.62) is too old to link with OpenSSL ${OPENSSL_VERSION} (1.1 or newer) found at ${OPENSSL_INCLUDE_DIR} and ${OPENSSL_LIBRARIES}. "
|
|
||||||
"Update Boost or install OpenSSL 1.0 and set path to it when running cmake: "
|
|
||||||
"cmake -DOPENSSL_ROOT_DIR='/usr/include/openssl-1.0'")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj")
|
||||||
@@ -1207,6 +1201,7 @@ endif()
|
|||||||
if(NOT ZMQ_LIB)
|
if(NOT ZMQ_LIB)
|
||||||
message(FATAL_ERROR "Could not find required libzmq")
|
message(FATAL_ERROR "Could not find required libzmq")
|
||||||
endif()
|
endif()
|
||||||
|
include_directories(${ZMQ_INCLUDE_PATH})
|
||||||
if(PGM_LIBRARY)
|
if(PGM_LIBRARY)
|
||||||
set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}")
|
set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
@@ -1220,7 +1215,15 @@ if(PROTOLIB_LIBRARY)
|
|||||||
set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}")
|
set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
if(SODIUM_LIBRARY)
|
if(SODIUM_LIBRARY)
|
||||||
|
message(STATUS "ZMQ_LIB: ${ZMQ_LIB};${SODIUM_LIBRARY}")
|
||||||
set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}")
|
set(ZMQ_LIB "${ZMQ_LIB};${SODIUM_LIBRARY}")
|
||||||
|
find_path(SODIUM_INCLUDE_PATH sodium/crypto_verify_32.h)
|
||||||
|
if (SODIUM_INCLUDE_PATH)
|
||||||
|
message(STATUS "SODIUM_INCLUDE_PATH: ${SODIUM_INCLUDE_PATH}")
|
||||||
|
include_directories(${SODIUM_INCLUDE_PATH})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Could not find required sodium/crypto_verify_32.h")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(BSD_LIBRARY)
|
if(BSD_LIBRARY)
|
||||||
set(ZMQ_LIB "${ZMQ_LIB};${BSD_LIBRARY}")
|
set(ZMQ_LIB "${ZMQ_LIB};${BSD_LIBRARY}")
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Dates are provided in the format YYYY-MM-DD.
|
|||||||
| - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support
|
| - | 2020-06-28 | Hallucinogenic Hypnotoad | v0.8.0.0 | v0.8.0.2 | Dandelion++ support
|
||||||
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.3.3 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
|
| 253,999 | 2020-10-09 | Illiterate Illuminati | v0.9.0.0 | v0.9.3.3 | Dynamic coinbase unlock (up to 1 mo.), Deterministic unlock times, Enforce maximum coinbase amount, show_qr_code wallet command, CLSAG
|
||||||
| 331,170 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.2.0 | Bulletproofs+, Miner Block Header Signing, Vote by Block, Change coinbase unlock time to 1 day, Reset difficulty and switch back to Monero's difficulty algorithm
|
| 331,170 | 2021-07-04 | Junkie Jeff | v0.10.0.0 | v0.10.2.0 | Bulletproofs+, Miner Block Header Signing, Vote by Block, Change coinbase unlock time to 1 day, Reset difficulty and switch back to Monero's difficulty algorithm
|
||||||
| 514,000 | 2023-04-01 | Kunty Karen | v0.11.0.0 | v0.11.2.0 | View tags, fee changes, adjusted dynamic block weight algorithm, multisig security fixes, RPC broadcast node donation sub-address, Limit tx_extra max size to ~1kb, 12-hour difficulty adjustment window
|
| 514,000 | 2023-04-01 | Kunty Karen | v0.11.0.0 | v0.11.3.0 | View tags, fee changes, adjusted dynamic block weight algorithm, multisig security fixes, RPC broadcast node donation sub-address, Limit tx_extra max size to ~1kb, 12-hour difficulty adjustment window
|
||||||
|
|
||||||
X's indicate that these details have not been determined as of commit date.
|
X's indicate that these details have not been determined as of commit date.
|
||||||
|
|
||||||
@@ -128,15 +128,16 @@ Packaging for your favorite distribution would be a welcome contribution!
|
|||||||
|
|
||||||
* Arch Linux/Manjaro
|
* Arch Linux/Manjaro
|
||||||
|
|
||||||
sudo pacman -Syu --needed base-devel cmake boost openssl zeromq libpgm unbound libsodium libunwind xz readline expat gtest python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd
|
sudo pacman -Syu --needed base-devel cmake boost openssl zeromq libpgm unbound libsodium libunwind xz readline expat gtest python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd gcc13
|
||||||
git clone https://codeberg.org/wownero/wownero && cd wownero
|
git clone https://codeberg.org/wownero/wownero && cd wownero
|
||||||
|
export CC=gcc-13 CXX=g++-13
|
||||||
make -j2
|
make -j2
|
||||||
|
|
||||||
* Debian/Ubuntu
|
* Debian/Ubuntu
|
||||||
|
|
||||||
sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz
|
sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz gcc-13 g++-13
|
||||||
git clone https://codeberg.org/wownero/wownero && cd wownero
|
git clone https://codeberg.org/wownero/wownero && cd wownero
|
||||||
make -j2
|
CC="gcc-13" CXX="g++-13" make -j2
|
||||||
|
|
||||||
|
|
||||||
## Running Binaries
|
## Running Binaries
|
||||||
|
|||||||
59
cmake/FindMiniupnpc.cmake
Normal file
59
cmake/FindMiniupnpc.cmake
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# --------------------------------- FindMiniupnpc Start ---------------------------------
|
||||||
|
# Locate miniupnp library
|
||||||
|
# This module defines
|
||||||
|
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
|
||||||
|
# MINIUPNP_LIBRARY, the miniupnp variant
|
||||||
|
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
|
||||||
|
# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
|
||||||
|
#
|
||||||
|
# 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/
|
||||||
|
|
||||||
|
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||||
|
# Already in cache, be silent
|
||||||
|
set(MINIUPNP_FIND_QUIETLY TRUE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
|
||||||
|
HINTS $ENV{MINIUPNP_INCLUDE_DIR}
|
||||||
|
PATH_SUFFIXES miniupnpc
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MINIUPNP_LIBRARY miniupnpc
|
||||||
|
HINTS $ENV{MINIUPNP_LIBRARY}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
|
||||||
|
HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
|
||||||
|
set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||||
|
set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
MiniUPnPc DEFAULT_MSG
|
||||||
|
MINIUPNP_INCLUDE_DIR
|
||||||
|
MINIUPNP_LIBRARY
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(MINIUPNPC_FOUND)
|
||||||
|
file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
|
||||||
|
if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
|
||||||
|
set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
|
||||||
|
message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
|
||||||
|
set(MINIUPNP_FOUND true)
|
||||||
|
set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
|
||||||
|
# --------------------------------- FindMiniupnpc End ---------------------------------
|
||||||
@@ -74,6 +74,7 @@ namespace epee
|
|||||||
public:
|
public:
|
||||||
using char_type = std::uint8_t;
|
using char_type = std::uint8_t;
|
||||||
using Ch = char_type;
|
using Ch = char_type;
|
||||||
|
using value_type = char_type;
|
||||||
|
|
||||||
//! Increase internal buffer by at least `byte_stream_increase` bytes.
|
//! Increase internal buffer by at least `byte_stream_increase` bytes.
|
||||||
byte_stream() noexcept
|
byte_stream() noexcept
|
||||||
@@ -86,6 +87,7 @@ namespace epee
|
|||||||
~byte_stream() noexcept = default;
|
~byte_stream() noexcept = default;
|
||||||
byte_stream& operator=(byte_stream&& rhs) noexcept;
|
byte_stream& operator=(byte_stream&& rhs) noexcept;
|
||||||
|
|
||||||
|
std::uint8_t* data() noexcept { return buffer_.get(); }
|
||||||
const std::uint8_t* data() const noexcept { return buffer_.get(); }
|
const std::uint8_t* data() const noexcept { return buffer_.get(); }
|
||||||
std::uint8_t* tellp() const noexcept { return next_write_; }
|
std::uint8_t* tellp() const noexcept { return next_write_; }
|
||||||
std::size_t available() const noexcept { return end_ - next_write_; }
|
std::size_t available() const noexcept { return end_ - next_write_; }
|
||||||
|
|||||||
@@ -171,6 +171,13 @@
|
|||||||
epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(rsp), response_info.m_body); \
|
epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(rsp), response_info.m_body); \
|
||||||
return true; \
|
return true; \
|
||||||
} \
|
} \
|
||||||
|
epee::serialization::storage_entry params_; \
|
||||||
|
params_ = epee::serialization::storage_entry(epee::serialization::section()); \
|
||||||
|
if(!ps.get_value("params", params_, nullptr)) \
|
||||||
|
{ \
|
||||||
|
epee::serialization::section params_section; \
|
||||||
|
ps.set_value("params", std::move(params_section), nullptr); \
|
||||||
|
} \
|
||||||
if(false) return true; //just a stub to have "else if"
|
if(false) return true; //just a stub to have "else if"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,6 @@ namespace string_tools
|
|||||||
std::string get_current_module_path();
|
std::string get_current_module_path();
|
||||||
#endif
|
#endif
|
||||||
void set_module_name_and_folder(const std::string& path_to_process_);
|
void set_module_name_and_folder(const std::string& path_to_process_);
|
||||||
void trim_left(std::string& str);
|
|
||||||
void trim_right(std::string& str);
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
inline std::string& trim(std::string& str)
|
inline std::string& trim(std::string& str)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,7 +152,11 @@ namespace epee
|
|||||||
{
|
{
|
||||||
std::size_t space_needed = 0;
|
std::size_t space_needed = 0;
|
||||||
for (const auto& source : sources)
|
for (const auto& source : sources)
|
||||||
|
{
|
||||||
|
if (std::numeric_limits<std::size_t>::max() - space_needed < source.size())
|
||||||
|
throw std::bad_alloc{};
|
||||||
space_needed += source.size();
|
space_needed += source.size();
|
||||||
|
}
|
||||||
|
|
||||||
if (space_needed)
|
if (space_needed)
|
||||||
{
|
{
|
||||||
@@ -162,9 +166,9 @@ namespace epee
|
|||||||
|
|
||||||
for (const auto& source : sources)
|
for (const auto& source : sources)
|
||||||
{
|
{
|
||||||
|
assert(source.size() <= out.size()); // see check above
|
||||||
std::memcpy(out.data(), source.data(), source.size());
|
std::memcpy(out.data(), source.data(), source.size());
|
||||||
if (out.remove_prefix(source.size()) < source.size())
|
out.remove_prefix(source.size());
|
||||||
throw std::bad_alloc{}; // size_t overflow on space_needed
|
|
||||||
}
|
}
|
||||||
storage_ = std::move(storage);
|
storage_ = std::move(storage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#include "readline_buffer.h"
|
#include "readline_buffer.h"
|
||||||
#include "string_tools.h"
|
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
#include <readline/history.h>
|
#include <readline/history.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -174,7 +173,7 @@ static void handle_line(char* line)
|
|||||||
line_stat = rdln::full;
|
line_stat = rdln::full;
|
||||||
the_line = line;
|
the_line = line;
|
||||||
std::string test_line = line;
|
std::string test_line = line;
|
||||||
epee::string_tools::trim_right(test_line);
|
boost::trim_right(test_line);
|
||||||
if(!test_line.empty())
|
if(!test_line.empty())
|
||||||
{
|
{
|
||||||
if (!same_as_last_line(test_line))
|
if (!same_as_last_line(test_line))
|
||||||
|
|||||||
@@ -174,19 +174,6 @@ namespace string_tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void trim_left(std::string& str)
|
|
||||||
{
|
|
||||||
boost::trim_left(str);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void trim_right(std::string& str)
|
|
||||||
{
|
|
||||||
boost::trim_right(str);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string pad_string(std::string s, size_t n, char c, bool prepend)
|
std::string pad_string(std::string s, size_t n, char c, bool prepend)
|
||||||
{
|
{
|
||||||
if (s.size() < n)
|
if (s.size() < n)
|
||||||
|
|||||||
5
external/CMakeLists.txt
vendored
5
external/CMakeLists.txt
vendored
@@ -35,13 +35,10 @@
|
|||||||
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
|
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
|
||||||
# others.
|
# others.
|
||||||
|
|
||||||
if(NOT MSVC)
|
find_package(Miniupnpc REQUIRED)
|
||||||
add_compile_options(-D_GNU_SOURCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Using in-tree miniupnpc")
|
message(STATUS "Using in-tree miniupnpc")
|
||||||
set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
|
set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
|
||||||
set(UPNPC_BUILD_TESTS FALSE CACHE BOOL "Disable miniupnp internal tests." FORCE)
|
|
||||||
add_subdirectory(miniupnp/miniupnpc)
|
add_subdirectory(miniupnp/miniupnpc)
|
||||||
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
|
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
|
||||||
set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|||||||
2
external/miniupnp
vendored
2
external/miniupnp
vendored
Submodule external/miniupnp updated: b55145ec09...544e6fcc73
Binary file not shown.
@@ -233,6 +233,7 @@ namespace cryptonote
|
|||||||
ADD_CHECKPOINT2(489400, "b14f49eae77398117ea93435676100d8b655a804689f73a5a4d0d5e71160d603", "0x1123c39bb52f7e");
|
ADD_CHECKPOINT2(489400, "b14f49eae77398117ea93435676100d8b655a804689f73a5a4d0d5e71160d603", "0x1123c39bb52f7e");
|
||||||
ADD_CHECKPOINT2(491200, "cedba73ad35ce7f51aaca2beb36dc32d79ecc716d146eb8211e6a815f3666c4a", "0x11334734abbd17");
|
ADD_CHECKPOINT2(491200, "cedba73ad35ce7f51aaca2beb36dc32d79ecc716d146eb8211e6a815f3666c4a", "0x11334734abbd17");
|
||||||
ADD_CHECKPOINT2(497100, "2c4c70ac1ada94151f19d67ccf1aa4e846e6067f49f67c85cc03f78e768ea42b", "0x116906bc97a751");
|
ADD_CHECKPOINT2(497100, "2c4c70ac1ada94151f19d67ccf1aa4e846e6067f49f67c85cc03f78e768ea42b", "0x116906bc97a751");
|
||||||
|
ADD_CHECKPOINT2(691500, "ed8e2507c0938b7eab7b02eccfb3506aeb591e51fbf6cf145fcc60ea2d351025", "0x163a280f2ce8e3");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1242,12 +1242,7 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<block_extended_info>
|
|||||||
// just the latter (because the rollback was done above).
|
// just the latter (because the rollback was done above).
|
||||||
rollback_blockchain_switching(disconnected_chain, split_height);
|
rollback_blockchain_switching(disconnected_chain, split_height);
|
||||||
|
|
||||||
// FIXME: Why do we keep invalid blocks around? Possibly in case we hear
|
|
||||||
// about them again so we can immediately dismiss them, but needs some
|
|
||||||
// looking into.
|
|
||||||
const crypto::hash blkid = cryptonote::get_block_hash(bei.bl);
|
const crypto::hash blkid = cryptonote::get_block_hash(bei.bl);
|
||||||
add_block_as_invalid(bei, blkid);
|
|
||||||
MERROR("The block was inserted as invalid while connecting new alternative chain, block_id: " << blkid);
|
|
||||||
m_db->remove_alt_block(blkid);
|
m_db->remove_alt_block(blkid);
|
||||||
alt_ch_iter++;
|
alt_ch_iter++;
|
||||||
|
|
||||||
@@ -1255,7 +1250,6 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<block_extended_info>
|
|||||||
{
|
{
|
||||||
const auto &bei = *alt_ch_to_orph_iter++;
|
const auto &bei = *alt_ch_to_orph_iter++;
|
||||||
const crypto::hash blkid = cryptonote::get_block_hash(bei.bl);
|
const crypto::hash blkid = cryptonote::get_block_hash(bei.bl);
|
||||||
add_block_as_invalid(bei, blkid);
|
|
||||||
m_db->remove_alt_block(blkid);
|
m_db->remove_alt_block(blkid);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -2471,7 +2465,7 @@ bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height,
|
|||||||
{
|
{
|
||||||
case STAGENET: start_height = stagenet_hard_forks[3].height; break;
|
case STAGENET: start_height = stagenet_hard_forks[3].height; break;
|
||||||
case TESTNET: start_height = testnet_hard_forks[3].height; break;
|
case TESTNET: start_height = testnet_hard_forks[3].height; break;
|
||||||
case MAINNET: start_height = mainnet_hard_forks[3].height; break;
|
case MAINNET: start_height = 0; break;
|
||||||
case FAKECHAIN: start_height = 0; break;
|
case FAKECHAIN: start_height = 0; break;
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
@@ -5672,7 +5666,7 @@ void Blockchain::cancel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PER_BLOCK_CHECKPOINT)
|
#if defined(PER_BLOCK_CHECKPOINT)
|
||||||
static const char expected_block_hashes_hash[] = "c321396d82f3987943018dfb0f974e39f8d21b2df360fcc3916a178504b1470d";
|
static const char expected_block_hashes_hash[] = "3ee7be44d391f20b389ed17b17443ffa26889ac943a57b4e493b833db67159c5";
|
||||||
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
|
void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints)
|
||||||
{
|
{
|
||||||
if (get_checkpoints == nullptr || !m_fast_sync)
|
if (get_checkpoints == nullptr || !m_fast_sync)
|
||||||
|
|||||||
@@ -696,6 +696,16 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args)
|
|||||||
std::ifstream ifs(ban_list_path.string());
|
std::ifstream ifs(ban_list_path.string());
|
||||||
for (std::string line; std::getline(ifs, line); )
|
for (std::string line; std::getline(ifs, line); )
|
||||||
{
|
{
|
||||||
|
// ignore comments after '#' character
|
||||||
|
const size_t pound_idx = line.find('#');
|
||||||
|
if (pound_idx != std::string::npos)
|
||||||
|
line.resize(pound_idx);
|
||||||
|
|
||||||
|
// trim whitespace and ignore empty lines
|
||||||
|
boost::trim(line);
|
||||||
|
if (line.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
auto subnet = net::get_ipv4_subnet_address(line);
|
auto subnet = net::get_ipv4_subnet_address(line);
|
||||||
if (subnet)
|
if (subnet)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ namespace lmdb
|
|||||||
//! \pre `!is_end()` \return Current key
|
//! \pre `!is_end()` \return Current key
|
||||||
K get_key() const noexcept
|
K get_key() const noexcept
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_trivially_copyable<K>(), "key is not memcpy safe");
|
||||||
assert(!is_end());
|
assert(!is_end());
|
||||||
K out;
|
K out;
|
||||||
std::memcpy(std::addressof(out), key.data(), sizeof(out));
|
std::memcpy(std::addressof(out), key.data(), sizeof(out));
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace lmdb
|
|||||||
static expect<F> get_value(MDB_val value) noexcept
|
static expect<F> get_value(MDB_val value) noexcept
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<U, V>(), "bad MONERO_FIELD?");
|
static_assert(std::is_same<U, V>(), "bad MONERO_FIELD?");
|
||||||
static_assert(std::is_pod<F>(), "F must be POD");
|
static_assert(std::is_trivially_copyable<F>(), "F must be memcpy safe");
|
||||||
static_assert(sizeof(F) + offset <= sizeof(U), "bad field type and/or offset");
|
static_assert(sizeof(F) + offset <= sizeof(U), "bad field type and/or offset");
|
||||||
|
|
||||||
if (value.mv_size != sizeof(U))
|
if (value.mv_size != sizeof(U))
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ namespace lmdb
|
|||||||
template<typename T, std::size_t offset = 0>
|
template<typename T, std::size_t offset = 0>
|
||||||
inline int less(MDB_val const* left, MDB_val const* right) noexcept
|
inline int less(MDB_val const* left, MDB_val const* right) noexcept
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_trivially_copyable<T>(), "memcpy will not work");
|
||||||
if (!left || !right || left->mv_size < sizeof(T) + offset || right->mv_size < sizeof(T) + offset)
|
if (!left || !right || left->mv_size < sizeof(T) + offset || right->mv_size < sizeof(T) + offset)
|
||||||
{
|
{
|
||||||
assert("invalid use of custom comparison" == 0);
|
assert("invalid use of custom comparison" == 0);
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ namespace lmdb
|
|||||||
G get_value() const noexcept
|
G get_value() const noexcept
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<U, T>(), "bad MONERO_FIELD usage?");
|
static_assert(std::is_same<U, T>(), "bad MONERO_FIELD usage?");
|
||||||
static_assert(std::is_pod<U>(), "value type must be pod");
|
static_assert(std::is_trivially_copyable<U>(), "value type must be memcpy safe");
|
||||||
static_assert(std::is_pod<G>(), "field type must be pod");
|
static_assert(std::is_trivially_copyable<G>(), "field type must be memcpy safe");
|
||||||
static_assert(sizeof(G) + uoffset <= sizeof(U), "bad field and/or offset");
|
static_assert(sizeof(G) + uoffset <= sizeof(U), "bad field and/or offset");
|
||||||
assert(sizeof(G) + uoffset <= values.size());
|
assert(sizeof(G) + uoffset <= values.size());
|
||||||
assert(!is_end());
|
assert(!is_end());
|
||||||
|
|||||||
@@ -60,9 +60,9 @@
|
|||||||
#include "cryptonote_core/cryptonote_core.h"
|
#include "cryptonote_core/cryptonote_core.h"
|
||||||
#include "net/parse.h"
|
#include "net/parse.h"
|
||||||
|
|
||||||
#include <miniupnpc.h>
|
#include <miniupnp/miniupnpc/miniupnpc.h>
|
||||||
#include <upnpcommands.h>
|
#include <miniupnp/miniupnpc/upnpcommands.h>
|
||||||
#include <upnperrors.h>
|
#include <miniupnp/miniupnpc/upnperrors.h>
|
||||||
|
|
||||||
#undef MONERO_DEFAULT_LOG_CATEGORY
|
#undef MONERO_DEFAULT_LOG_CATEGORY
|
||||||
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
|
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p"
|
||||||
@@ -531,6 +531,16 @@ namespace nodetool
|
|||||||
std::istringstream iss(banned_ips);
|
std::istringstream iss(banned_ips);
|
||||||
for (std::string line; std::getline(iss, line); )
|
for (std::string line; std::getline(iss, line); )
|
||||||
{
|
{
|
||||||
|
// ignore comments after '#' character
|
||||||
|
const size_t pound_idx = line.find('#');
|
||||||
|
if (pound_idx != std::string::npos)
|
||||||
|
line.resize(pound_idx);
|
||||||
|
|
||||||
|
// trim whitespace and ignore empty lines
|
||||||
|
boost::trim(line);
|
||||||
|
if (line.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
auto subnet = net::get_ipv4_subnet_address(line);
|
auto subnet = net::get_ipv4_subnet_address(line);
|
||||||
if (subnet)
|
if (subnet)
|
||||||
{
|
{
|
||||||
@@ -2968,8 +2978,7 @@ namespace nodetool
|
|||||||
UPNPUrls urls;
|
UPNPUrls urls;
|
||||||
IGDdatas igdData;
|
IGDdatas igdData;
|
||||||
char lanAddress[64];
|
char lanAddress[64];
|
||||||
char wanaddr[64]; /* up address of the IGD on the WAN */
|
result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress);
|
||||||
result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanaddr, sizeof wanaddr);
|
|
||||||
freeUPNPDevlist(deviceList);
|
freeUPNPDevlist(deviceList);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
if (result == 1) {
|
if (result == 1) {
|
||||||
@@ -3037,8 +3046,7 @@ namespace nodetool
|
|||||||
UPNPUrls urls;
|
UPNPUrls urls;
|
||||||
IGDdatas igdData;
|
IGDdatas igdData;
|
||||||
char lanAddress[64];
|
char lanAddress[64];
|
||||||
char wanaddr[64]; /* up address of the IGD on the WAN */
|
result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress);
|
||||||
result = UPNP_GetValidIGD(deviceList, &urls, &igdData, lanAddress, sizeof lanAddress, wanaddr, sizeof wanaddr);
|
|
||||||
freeUPNPDevlist(deviceList);
|
freeUPNPDevlist(deviceList);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
if (result == 1) {
|
if (result == 1) {
|
||||||
|
|||||||
@@ -96,31 +96,12 @@ monero_private_headers(daemon_rpc_server
|
|||||||
monero_add_library(rpc_base
|
monero_add_library(rpc_base
|
||||||
${rpc_base_sources}
|
${rpc_base_sources}
|
||||||
${rpc_base_headers}
|
${rpc_base_headers}
|
||||||
${rpc_base_private_headers}
|
${rpc_base_private_headers})
|
||||||
LINKS
|
|
||||||
common
|
|
||||||
epee
|
|
||||||
${Boost_REGEX_LIBRARY}
|
|
||||||
${Boost_THREAD_LIBRARY}
|
|
||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
|
||||||
PRIVATE_LINKS
|
|
||||||
${EXTRA_LIBRARIES})
|
|
||||||
|
|
||||||
monero_add_library(rpc
|
monero_add_library(rpc
|
||||||
${rpc_sources}
|
${rpc_sources}
|
||||||
${rpc_headers}
|
${rpc_headers}
|
||||||
${rpc_private_headers}
|
${rpc_private_headers})
|
||||||
LINKS
|
|
||||||
rpc_base
|
|
||||||
common
|
|
||||||
cryptonote_core
|
|
||||||
cryptonote_protocol
|
|
||||||
net
|
|
||||||
version
|
|
||||||
${Boost_REGEX_LIBRARY}
|
|
||||||
${Boost_THREAD_LIBRARY}
|
|
||||||
PRIVATE_LINKS
|
|
||||||
${EXTRA_LIBRARIES})
|
|
||||||
|
|
||||||
monero_add_library(rpc_pub
|
monero_add_library(rpc_pub
|
||||||
${rpc_pub_sources}
|
${rpc_pub_sources}
|
||||||
@@ -137,6 +118,30 @@ monero_add_library(daemon_rpc_server
|
|||||||
${daemon_rpc_server_headers}
|
${daemon_rpc_server_headers}
|
||||||
${daemon_rpc_server_private_headers})
|
${daemon_rpc_server_private_headers})
|
||||||
|
|
||||||
|
|
||||||
|
target_link_libraries(rpc_base
|
||||||
|
PUBLIC
|
||||||
|
common
|
||||||
|
epee
|
||||||
|
${Boost_REGEX_LIBRARY}
|
||||||
|
${Boost_THREAD_LIBRARY}
|
||||||
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
|
PRIVATE
|
||||||
|
${EXTRA_LIBRARIES})
|
||||||
|
|
||||||
|
target_link_libraries(rpc
|
||||||
|
PUBLIC
|
||||||
|
rpc_base
|
||||||
|
common
|
||||||
|
cryptonote_core
|
||||||
|
cryptonote_protocol
|
||||||
|
net
|
||||||
|
version
|
||||||
|
${Boost_REGEX_LIBRARY}
|
||||||
|
${Boost_THREAD_LIBRARY}
|
||||||
|
PRIVATE
|
||||||
|
${EXTRA_LIBRARIES})
|
||||||
|
|
||||||
target_link_libraries(rpc_pub
|
target_link_libraries(rpc_pub
|
||||||
PUBLIC
|
PUBLIC
|
||||||
epee
|
epee
|
||||||
|
|||||||
@@ -8886,6 +8886,22 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
|||||||
|
|
||||||
PAUSE_READLINE();
|
PAUSE_READLINE();
|
||||||
|
|
||||||
|
auto formatter = boost::format("%8.8s %6.6s %8.8s %25.25s %20.20s %64.64s %15.15s %14.14s %s %s - %s");
|
||||||
|
message_writer(console_color_default, false) << formatter
|
||||||
|
% "Block"
|
||||||
|
% "In/Out"
|
||||||
|
% "Locked?"
|
||||||
|
% "Timestamp"
|
||||||
|
% "Amount"
|
||||||
|
% "Tx Hash"
|
||||||
|
% "Tx Payment ID"
|
||||||
|
% "Tx Fee"
|
||||||
|
% "Destination(s)"
|
||||||
|
% "Index"
|
||||||
|
% "Tx Note";
|
||||||
|
|
||||||
|
formatter = boost::format("%8.8llu %6.6s %8.8s %25.25s %20.20s %64.64s %15.15s %14.14s %s %s - %s");
|
||||||
|
|
||||||
for (const auto& transfer : all_transfers)
|
for (const auto& transfer : all_transfers)
|
||||||
{
|
{
|
||||||
const auto color = transfer.type == "failed" ? console_color_red : transfer.confirmed ? ((transfer.direction == "in" || transfer.direction == "block") ? console_color_green : console_color_magenta) : console_color_default;
|
const auto color = transfer.type == "failed" ? console_color_red : transfer.confirmed ? ((transfer.direction == "in" || transfer.direction == "block") ? console_color_green : console_color_magenta) : console_color_default;
|
||||||
@@ -8902,8 +8918,6 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto formatter = boost::format("%8.8llu %6.6s %8.8s %25.25s %20.20s %s %s %14.14s %s %s - %s");
|
|
||||||
|
|
||||||
message_writer(color, false) << formatter
|
message_writer(color, false) << formatter
|
||||||
% transfer.block
|
% transfer.block
|
||||||
% transfer.direction
|
% transfer.direction
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||||
#define DEF_MONERO_VERSION "0.11.2.0"
|
#define DEF_MONERO_VERSION "0.11.3.0"
|
||||||
#define DEF_MONERO_RELEASE_NAME "Kunty Karen"
|
#define DEF_MONERO_RELEASE_NAME "Kunty Karen"
|
||||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||||
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
|
#define DEF_MONERO_VERSION_IS_RELEASE @VERSION_IS_RELEASE@
|
||||||
|
|||||||
@@ -1280,6 +1280,11 @@ bool wallet2::has_stagenet_option(const boost::program_options::variables_map& v
|
|||||||
return command_line::get_arg(vm, options().stagenet);
|
return command_line::get_arg(vm, options().stagenet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wallet2::has_proxy_option() const
|
||||||
|
{
|
||||||
|
return !m_proxy.empty();
|
||||||
|
}
|
||||||
|
|
||||||
std::string wallet2::device_name_option(const boost::program_options::variables_map& vm)
|
std::string wallet2::device_name_option(const boost::program_options::variables_map& vm)
|
||||||
{
|
{
|
||||||
return command_line::get_arg(vm, options().hw_device);
|
return command_line::get_arg(vm, options().hw_device);
|
||||||
@@ -1364,12 +1369,15 @@ std::unique_ptr<wallet2> wallet2::make_dummy(const boost::program_options::varia
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::set_daemon(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options)
|
bool wallet2::set_daemon(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options, const std::string& proxy)
|
||||||
{
|
{
|
||||||
boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
|
boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
|
||||||
|
|
||||||
if(m_http_client->is_connected())
|
if(m_http_client->is_connected())
|
||||||
m_http_client->disconnect();
|
m_http_client->disconnect();
|
||||||
|
CHECK_AND_ASSERT_MES2(m_proxy.empty() || proxy.empty() , "It is not possible to set global proxy (--proxy) and daemon specific proxy together.");
|
||||||
|
if(m_proxy.empty())
|
||||||
|
CHECK_AND_ASSERT_MES(set_proxy(proxy), false, "failed to set proxy address");
|
||||||
const bool changed = m_daemon_address != daemon_address;
|
const bool changed = m_daemon_address != daemon_address;
|
||||||
m_daemon_address = std::move(daemon_address);
|
m_daemon_address = std::move(daemon_address);
|
||||||
m_daemon_login = std::move(daemon_login);
|
m_daemon_login = std::move(daemon_login);
|
||||||
@@ -1404,7 +1412,8 @@ bool wallet2::set_proxy(const std::string &address)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::init(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, const std::string &proxy_address, uint64_t upper_transaction_weight_limit, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options)
|
bool wallet2::init(std::string daemon_address, boost::optional<epee::net_utils::http::login> daemon_login, const std::string &proxy_address, uint64_t upper_transaction_weight_limit, bool trusted_daemon, epee::net_utils::ssl_options_t ssl_options)
|
||||||
{
|
{
|
||||||
CHECK_AND_ASSERT_MES(set_proxy(proxy_address), false, "failed to set proxy address");
|
m_proxy = proxy_address;
|
||||||
|
CHECK_AND_ASSERT_MES(set_proxy(m_proxy), false, "failed to set proxy address");
|
||||||
m_checkpoints.init_default_checkpoints(m_nettype);
|
m_checkpoints.init_default_checkpoints(m_nettype);
|
||||||
m_is_initialized = true;
|
m_is_initialized = true;
|
||||||
m_upper_transaction_weight_limit = upper_transaction_weight_limit;
|
m_upper_transaction_weight_limit = upper_transaction_weight_limit;
|
||||||
@@ -6143,7 +6152,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass
|
|||||||
bool r = true;
|
bool r = true;
|
||||||
if (use_fs)
|
if (use_fs)
|
||||||
{
|
{
|
||||||
load_from_file(m_wallet_file, cache_file_buf, std::numeric_limits<size_t>::max());
|
r = load_from_file(m_wallet_file, cache_file_buf, std::numeric_limits<size_t>::max());
|
||||||
THROW_WALLET_EXCEPTION_IF(!r, error::file_read_error, m_wallet_file);
|
THROW_WALLET_EXCEPTION_IF(!r, error::file_read_error, m_wallet_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8799,8 +8808,8 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
|||||||
// check we're clear enough of rct start, to avoid corner cases below
|
// check we're clear enough of rct start, to avoid corner cases below
|
||||||
THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE,
|
THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE,
|
||||||
error::get_output_distribution, "Not enough rct outputs");
|
error::get_output_distribution, "Not enough rct outputs");
|
||||||
//THROW_WALLET_EXCEPTION_IF(rct_offsets.back() <= max_rct_index,
|
THROW_WALLET_EXCEPTION_IF(rct_offsets.back() <= max_rct_index,
|
||||||
//error::get_output_distribution, "Daemon reports suspicious number of rct outputs");
|
error::get_output_distribution, "Daemon reports suspicious number of rct outputs");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get histogram for the amounts we need
|
// get histogram for the amounts we need
|
||||||
|
|||||||
@@ -971,6 +971,12 @@ private:
|
|||||||
|
|
||||||
std::string path() const;
|
std::string path() const;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief has_proxy_option Check the global proxy (--proxy) has been defined or not.
|
||||||
|
* \return returns bool representing the global proxy (--proxy).
|
||||||
|
*/
|
||||||
|
bool has_proxy_option() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief verifies given password is correct for default wallet keys file
|
* \brief verifies given password is correct for default wallet keys file
|
||||||
*/
|
*/
|
||||||
@@ -1001,7 +1007,8 @@ private:
|
|||||||
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect);
|
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect);
|
||||||
bool set_daemon(std::string daemon_address = "http://localhost:8080",
|
bool set_daemon(std::string daemon_address = "http://localhost:8080",
|
||||||
boost::optional<epee::net_utils::http::login> daemon_login = boost::none, bool trusted_daemon = true,
|
boost::optional<epee::net_utils::http::login> daemon_login = boost::none, bool trusted_daemon = true,
|
||||||
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect);
|
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_autodetect,
|
||||||
|
const std::string &proxy = "");
|
||||||
bool set_proxy(const std::string &address);
|
bool set_proxy(const std::string &address);
|
||||||
|
|
||||||
void stop() { m_run.store(false, std::memory_order_relaxed); m_message_store.stop(); }
|
void stop() { m_run.store(false, std::memory_order_relaxed); m_message_store.stop(); }
|
||||||
@@ -1834,6 +1841,7 @@ private:
|
|||||||
cryptonote::account_base m_account;
|
cryptonote::account_base m_account;
|
||||||
boost::optional<epee::net_utils::http::login> m_daemon_login;
|
boost::optional<epee::net_utils::http::login> m_daemon_login;
|
||||||
std::string m_daemon_address;
|
std::string m_daemon_address;
|
||||||
|
std::string m_proxy;
|
||||||
std::string m_wallet_file;
|
std::string m_wallet_file;
|
||||||
std::string m_keys_file;
|
std::string m_keys_file;
|
||||||
std::string m_mms_file;
|
std::string m_mms_file;
|
||||||
|
|||||||
@@ -3465,7 +3465,7 @@ namespace tools
|
|||||||
if (!wal)
|
if (!wal)
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||||
er.message = "Failed to open wallet";
|
er.message = "Failed to open wallet : " + (!er.message.empty() ? er.message : "Unknown.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4438,6 +4438,13 @@ namespace tools
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_wallet->has_proxy_option() && !req.proxy.empty())
|
||||||
|
{
|
||||||
|
er.code = WALLET_RPC_ERROR_CODE_PROXY_ALREADY_DEFINED;
|
||||||
|
er.message = "It is not possible to set daemon specific proxy when --proxy is defined.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::vector<uint8_t>> ssl_allowed_fingerprints;
|
std::vector<std::vector<uint8_t>> ssl_allowed_fingerprints;
|
||||||
ssl_allowed_fingerprints.reserve(req.ssl_allowed_fingerprints.size());
|
ssl_allowed_fingerprints.reserve(req.ssl_allowed_fingerprints.size());
|
||||||
for (const std::string &fp: req.ssl_allowed_fingerprints)
|
for (const std::string &fp: req.ssl_allowed_fingerprints)
|
||||||
@@ -4480,7 +4487,7 @@ namespace tools
|
|||||||
if (!req.username.empty() || !req.password.empty())
|
if (!req.username.empty() || !req.password.empty())
|
||||||
daemon_login.emplace(req.username, req.password);
|
daemon_login.emplace(req.username, req.password);
|
||||||
|
|
||||||
if (!m_wallet->set_daemon(req.address, daemon_login, req.trusted, std::move(ssl_options)))
|
if (!m_wallet->set_daemon(req.address, daemon_login, req.trusted, std::move(ssl_options), req.proxy))
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION;
|
er.code = WALLET_RPC_ERROR_CODE_NO_DAEMON_CONNECTION;
|
||||||
er.message = std::string("Unable to set daemon");
|
er.message = std::string("Unable to set daemon");
|
||||||
|
|||||||
@@ -2598,6 +2598,7 @@ namespace wallet_rpc
|
|||||||
std::string ssl_ca_file;
|
std::string ssl_ca_file;
|
||||||
std::vector<std::string> ssl_allowed_fingerprints;
|
std::vector<std::string> ssl_allowed_fingerprints;
|
||||||
bool ssl_allow_any_cert;
|
bool ssl_allow_any_cert;
|
||||||
|
std::string proxy;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(address)
|
KV_SERIALIZE(address)
|
||||||
@@ -2610,6 +2611,7 @@ namespace wallet_rpc
|
|||||||
KV_SERIALIZE(ssl_ca_file)
|
KV_SERIALIZE(ssl_ca_file)
|
||||||
KV_SERIALIZE(ssl_allowed_fingerprints)
|
KV_SERIALIZE(ssl_allowed_fingerprints)
|
||||||
KV_SERIALIZE_OPT(ssl_allow_any_cert, false)
|
KV_SERIALIZE_OPT(ssl_allow_any_cert, false)
|
||||||
|
KV_SERIALIZE_OPT(proxy, (std::string)"")
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
typedef epee::misc_utils::struct_init<request_t> request;
|
typedef epee::misc_utils::struct_init<request_t> request;
|
||||||
|
|||||||
17
tests/data/node/banlist_1.txt
Normal file
17
tests/data/node/banlist_1.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# magicfolk
|
||||||
|
255.255.255.0 # Saruman the White
|
||||||
|
128.128.128.0 # Gandalf the Gray
|
||||||
|
150.75.0.0 # Radagast the Brown
|
||||||
|
99.98.0.0/16 # All of Misty Mountain
|
||||||
|
|
||||||
|
# personal enemies
|
||||||
|
1.2.3.4 # this woman used to give me swirlies
|
||||||
|
6.7.8.9 # I just don't like the cut of his jib
|
||||||
|
1.0.0.7#Literally James Bond, he wrecked my aston martin
|
||||||
|
100.98.1.13 # Earl from HOA
|
||||||
|
100.98.1.0/24 #The rest of the HOA for good measure
|
||||||
|
#
|
||||||
|
|
||||||
|
#7.7.7.7
|
||||||
|
#^^^We're chill now, she's truly an angel
|
||||||
|
|
||||||
@@ -29,8 +29,11 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "serialization/keyvalue_serialization.h"
|
||||||
#include "storages/portable_storage.h"
|
#include "storages/portable_storage.h"
|
||||||
|
#include "storages/portable_storage_template_helper.h"
|
||||||
#include "span.h"
|
#include "span.h"
|
||||||
|
|
||||||
TEST(epee_binary, two_keys)
|
TEST(epee_binary, two_keys)
|
||||||
@@ -54,3 +57,68 @@ TEST(epee_binary, duplicate_key)
|
|||||||
epee::serialization::portable_storage storage{};
|
epee::serialization::portable_storage storage{};
|
||||||
EXPECT_FALSE(storage.load_from_binary(data));
|
EXPECT_FALSE(storage.load_from_binary(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename t_param>
|
||||||
|
struct ParentObjWithOptChild
|
||||||
|
{
|
||||||
|
t_param params;
|
||||||
|
|
||||||
|
ParentObjWithOptChild(): params{} {}
|
||||||
|
|
||||||
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
|
KV_SERIALIZE(params)
|
||||||
|
END_KV_SERIALIZE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ObjWithOptChild
|
||||||
|
{
|
||||||
|
bool test_value;
|
||||||
|
|
||||||
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
|
KV_SERIALIZE_OPT(test_value, true);
|
||||||
|
END_KV_SERIALIZE_MAP()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(epee_binary, serialize_deserialize)
|
||||||
|
{
|
||||||
|
ParentObjWithOptChild<ObjWithOptChild> o;
|
||||||
|
std::string o_json;
|
||||||
|
o.params.test_value = true;
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::store_t_to_json(o, o_json));
|
||||||
|
EXPECT_TRUE(o.params.test_value);
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::load_t_from_json(o, o_json));
|
||||||
|
EXPECT_TRUE(o.params.test_value);
|
||||||
|
|
||||||
|
ParentObjWithOptChild<ObjWithOptChild> o2;
|
||||||
|
std::string o2_json;
|
||||||
|
o.params.test_value = false;
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::store_t_to_json(o2, o2_json));
|
||||||
|
EXPECT_FALSE(o2.params.test_value);
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::load_t_from_json(o2, o2_json));
|
||||||
|
EXPECT_FALSE(o2.params.test_value);
|
||||||
|
|
||||||
|
// compiler sets default value of test_value to false
|
||||||
|
ParentObjWithOptChild<ObjWithOptChild> o3;
|
||||||
|
std::string o3_json;
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::store_t_to_json(o3, o3_json));
|
||||||
|
EXPECT_FALSE(o3.params.test_value);
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::load_t_from_json(o3, o3_json));
|
||||||
|
EXPECT_FALSE(o3.params.test_value);
|
||||||
|
|
||||||
|
// test optional field default initialization.
|
||||||
|
ParentObjWithOptChild<ObjWithOptChild> o4;
|
||||||
|
std::string o4_json = "{\"params\": {}}";
|
||||||
|
|
||||||
|
EXPECT_TRUE(epee::serialization::load_t_from_json(o4, o4_json));
|
||||||
|
EXPECT_TRUE(o4.params.test_value);
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "cryptonote_core/i_core_events.h"
|
#include "cryptonote_core/i_core_events.h"
|
||||||
#include "cryptonote_protocol/cryptonote_protocol_handler.h"
|
#include "cryptonote_protocol/cryptonote_protocol_handler.h"
|
||||||
#include "cryptonote_protocol/cryptonote_protocol_handler.inl"
|
#include "cryptonote_protocol/cryptonote_protocol_handler.inl"
|
||||||
|
#include "unit_tests_utils.h"
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
|
||||||
#define MAKE_IPV4_ADDRESS(a,b,c,d) epee::net_utils::ipv4_network_address{MAKE_IP(a,b,c,d),0}
|
#define MAKE_IPV4_ADDRESS(a,b,c,d) epee::net_utils::ipv4_network_address{MAKE_IP(a,b,c,d),0}
|
||||||
@@ -114,6 +115,18 @@ static bool is_blocked(Server &server, const epee::net_utils::network_address &a
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (address.get_type_id() != epee::net_utils::address_type::ipv4)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const epee::net_utils::ipv4_network_address ipv4_address = address.as<epee::net_utils::ipv4_network_address>();
|
||||||
|
|
||||||
|
// check if in a blocked ipv4 subnet
|
||||||
|
const std::map<epee::net_utils::ipv4_network_subnet, time_t> subnets = server.get_blocked_subnets();
|
||||||
|
for (const auto &subnet : subnets)
|
||||||
|
if (subnet.first.matches(ipv4_address))
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,6 +279,78 @@ TEST(ban, ignores_port)
|
|||||||
ASSERT_FALSE(is_blocked(server,MAKE_IPV4_ADDRESS_PORT(1,2,3,4,6)));
|
ASSERT_FALSE(is_blocked(server,MAKE_IPV4_ADDRESS_PORT(1,2,3,4,6)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(ban, file_banlist)
|
||||||
|
{
|
||||||
|
test_core pr_core;
|
||||||
|
cryptonote::t_cryptonote_protocol_handler<test_core> cprotocol(pr_core, NULL);
|
||||||
|
Server server(cprotocol);
|
||||||
|
cprotocol.set_p2p_endpoint(&server);
|
||||||
|
|
||||||
|
auto create_node_dir = [](){
|
||||||
|
boost::system::error_code ec;
|
||||||
|
auto path = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path("daemon-%%%%%%%%%%%%%%%%", ec);
|
||||||
|
if (ec)
|
||||||
|
return boost::filesystem::path{};
|
||||||
|
auto success = boost::filesystem::create_directory(path, ec);
|
||||||
|
if (!ec && success)
|
||||||
|
return path;
|
||||||
|
return boost::filesystem::path{};
|
||||||
|
};
|
||||||
|
const auto node_dir = create_node_dir();
|
||||||
|
ASSERT_TRUE(!node_dir.empty());
|
||||||
|
auto auto_remove_node_dir = epee::misc_utils::create_scope_leave_handler([&node_dir](){
|
||||||
|
boost::filesystem::remove_all(node_dir);
|
||||||
|
});
|
||||||
|
|
||||||
|
boost::program_options::variables_map vm;
|
||||||
|
boost::program_options::store(
|
||||||
|
boost::program_options::command_line_parser({
|
||||||
|
"--data-dir",
|
||||||
|
node_dir.string(),
|
||||||
|
"--ban-list",
|
||||||
|
(unit_test::data_dir / "node" / "banlist_1.txt").string()
|
||||||
|
}).options([]{
|
||||||
|
boost::program_options::options_description options_description{};
|
||||||
|
cryptonote::core::init_options(options_description);
|
||||||
|
Server::init_options(options_description);
|
||||||
|
return options_description;
|
||||||
|
}()).run(),
|
||||||
|
vm
|
||||||
|
);
|
||||||
|
|
||||||
|
ASSERT_TRUE(server.init(vm));
|
||||||
|
|
||||||
|
// Test cases (look in the banlist_1.txt file)
|
||||||
|
|
||||||
|
// magicfolk
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(255,255,255,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(128,128,128,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(150,75,0,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(99,98,0,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(99,98,0,255,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(99,98,1,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(99,98,1,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(99,98,255,255,9999)) );
|
||||||
|
EXPECT_FALSE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(99,99,0,0,9999)) );
|
||||||
|
|
||||||
|
// personal enemies
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(1,2,3,4,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(6,7,8,9,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(1,0,0,7,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(1,0,0,7,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(100,98,1,13,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(100,98,1,0,9999)) );
|
||||||
|
EXPECT_TRUE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(100,98,1,255,9999)) );
|
||||||
|
EXPECT_FALSE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(100,98,2,0,9999)) );
|
||||||
|
EXPECT_FALSE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(100,98,0,255,9999)) );
|
||||||
|
|
||||||
|
// angel
|
||||||
|
EXPECT_FALSE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(007,007,007,007,9999)) );
|
||||||
|
|
||||||
|
// random IP
|
||||||
|
EXPECT_FALSE( is_blocked(server, MAKE_IPV4_ADDRESS_PORT(145,036,205,235,9999)) );
|
||||||
|
}
|
||||||
|
|
||||||
TEST(node_server, bind_same_p2p_port)
|
TEST(node_server, bind_same_p2p_port)
|
||||||
{
|
{
|
||||||
struct test_data_t
|
struct test_data_t
|
||||||
|
|||||||
Reference in New Issue
Block a user