diff options
98 files changed, 418 insertions, 250 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 6d369d4d8..4ea3fa54b 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -27,6 +27,7 @@ #pragma once #include "misc_log_ex.h" +#include "string_tools.h" #include <atomic> #include <condition_variable> #include <functional> @@ -37,6 +38,8 @@ #include <stdio.h> #endif #include <boost/thread.hpp> +#include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/split.hpp> #ifdef HAVE_READLINE #include "readline_buffer.h" diff --git a/contrib/epee/include/file_io_utils.h b/contrib/epee/include/file_io_utils.h index c387743a6..f037b4dd5 100644 --- a/contrib/epee/include/file_io_utils.h +++ b/contrib/epee/include/file_io_utils.h @@ -29,7 +29,8 @@ #define _FILE_IO_UTILS_H_ #include <iostream> -#include <boost/filesystem.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> namespace epee { @@ -63,7 +64,7 @@ namespace file_io_utils } inline - bool get_file_time(const std::string& path_to_file, OUT time_t& ft) + bool get_file_time(const std::string& path_to_file, time_t& ft) { boost::system::error_code ec; ft = boost::filesystem::last_write_time(boost::filesystem::path(path_to_file), ec); diff --git a/contrib/epee/include/math_helper.h b/contrib/epee/include/math_helper.h index 90398acbb..ef839f609 100644 --- a/contrib/epee/include/math_helper.h +++ b/contrib/epee/include/math_helper.h @@ -37,6 +37,7 @@ #include <boost/uuid/random_generator.hpp> #include "misc_os_dependent.h" +#include "syncobj.h" namespace epee { diff --git a/contrib/epee/include/misc_log_ex.h b/contrib/epee/include/misc_log_ex.h index 67fd93206..35ec0950b 100644 --- a/contrib/epee/include/misc_log_ex.h +++ b/contrib/epee/include/misc_log_ex.h @@ -28,26 +28,7 @@ #ifndef _MISC_LOG_EX_H_ #define _MISC_LOG_EX_H_ -#include "static_initializer.h" -#include "string_tools.h" -#include "time_helper.h" -#include "misc_os_dependent.h" - -#include "syncobj.h" - -#include <iostream> -#include <sstream> -#include <iomanip> -#include <fstream> -#include <algorithm> -#include <list> -#include <map> #include <string> -#include <time.h> -#include <boost/cstdint.hpp> -#include <boost/thread.hpp> -#include <boost/filesystem.hpp> -#include <boost/algorithm/string.hpp> #include "easylogging++.h" diff --git a/contrib/epee/include/misc_os_dependent.h b/contrib/epee/include/misc_os_dependent.h index 69ded09e5..81cecf714 100644 --- a/contrib/epee/include/misc_os_dependent.h +++ b/contrib/epee/include/misc_os_dependent.h @@ -42,6 +42,9 @@ #include <mach/mach.h> #endif +#include <iostream> +#include <boost/lexical_cast.hpp> + #pragma once namespace epee { diff --git a/contrib/epee/include/net/abstract_tcp_server2.h b/contrib/epee/include/net/abstract_tcp_server2.h index 33fec8ec5..c0401c8b0 100644 --- a/contrib/epee/include/net/abstract_tcp_server2.h +++ b/contrib/epee/include/net/abstract_tcp_server2.h @@ -54,8 +54,8 @@ #include <boost/thread/thread.hpp> #include "net_utils_base.h" #include "syncobj.h" -#include "../../../../src/p2p/connection_basic.hpp" -#include "../../../../src/p2p/network_throttle-detail.hpp" +#include "connection_basic.hpp" +#include "network_throttle-detail.hpp" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "net" diff --git a/src/p2p/connection_basic.hpp b/contrib/epee/include/net/connection_basic.hpp index 16de469a7..16de469a7 100644 --- a/src/p2p/connection_basic.hpp +++ b/contrib/epee/include/net/connection_basic.hpp diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h index d77c84c28..1a9d5d064 100644 --- a/contrib/epee/include/net/http_client.h +++ b/contrib/epee/include/net/http_client.h @@ -50,6 +50,7 @@ #include "http_auth.h" #include "to_nonconst_iterator.h" #include "net_parse_helpers.h" +#include "syncobj.h" //#include "shlwapi.h" diff --git a/contrib/epee/include/net/http_client_base.h b/contrib/epee/include/net/http_client_base.h index f5fb57d03..c3da28718 100644 --- a/contrib/epee/include/net/http_client_base.h +++ b/contrib/epee/include/net/http_client_base.h @@ -38,8 +38,8 @@ namespace epee virtual ~i_sub_handler(){} virtual bool update_in( std::string& piece_of_transfer)=0; - virtual void stop(std::string& OUT collect_remains)=0; - virtual bool update_and_stop(std::string& OUT collect_remains, bool& is_changed) + virtual void stop(std::string& collect_remains)=0; + virtual bool update_and_stop(std::string& collect_remains, bool& is_changed) { is_changed = true; bool res = this->update_in(collect_remains); @@ -66,7 +66,7 @@ namespace epee { return m_powner_filter->handle_target_data(piece_of_transfer); } - virtual void stop(std::string& OUT collect_remains) + virtual void stop(std::string& collect_remains) { } diff --git a/contrib/epee/include/net/levin_protocol_handler_async.h b/contrib/epee/include/net/levin_protocol_handler_async.h index 7ad6d198b..7b526e4e7 100644 --- a/contrib/epee/include/net/levin_protocol_handler_async.h +++ b/contrib/epee/include/net/levin_protocol_handler_async.h @@ -35,6 +35,8 @@ #include "levin_base.h" #include "misc_language.h" +#include "syncobj.h" +#include "misc_os_dependent.h" #include <random> #include <chrono> diff --git a/contrib/epee/include/net/net_helper.h b/contrib/epee/include/net/net_helper.h index ee0e13fc1..2c2efcd82 100644 --- a/contrib/epee/include/net/net_helper.h +++ b/contrib/epee/include/net/net_helper.h @@ -31,23 +31,16 @@ //#include <Winsock2.h> //#include <Ws2tcpip.h> -#include <boost/lexical_cast.hpp> -#include <iostream> -#include <istream> -#include <ostream> #include <string> #include <boost/version.hpp> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> #include <boost/asio/steady_timer.hpp> -#include <boost/preprocessor/selection/min.hpp> #include <boost/lambda/bind.hpp> #include <boost/lambda/lambda.hpp> #include <boost/interprocess/detail/atomic.hpp> #include "net/net_utils_base.h" #include "misc_language.h" -//#include "profile_tools.h" -#include "../string_tools.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "net" diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h index 04e3fe6a4..7615786be 100644 --- a/contrib/epee/include/net/net_utils_base.h +++ b/contrib/epee/include/net/net_utils_base.h @@ -29,13 +29,11 @@ #ifndef _NET_UTILS_BASE_H_ #define _NET_UTILS_BASE_H_ -#include <boost/asio/io_service.hpp> #include <boost/uuid/uuid.hpp> -#include <memory> +#include <boost/asio/io_service.hpp> #include <typeinfo> #include <type_traits> #include "serialization/keyvalue_serialization.h" -#include "string_tools.h" #include "misc_log_ex.h" #undef MONERO_DEFAULT_LOG_CATEGORY @@ -45,7 +43,6 @@ #define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24)) #endif - namespace epee { namespace net_utils @@ -214,19 +211,8 @@ namespace net_utils inline bool operator>=(const network_address& lhs, const network_address& rhs) { return !lhs.less(rhs); } - inline bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0) - { - uint32_t ip; - uint16_t port; - if (epee::string_tools::parse_peer_from_string(ip, port, string)) - { - if (default_port && !port) - port = default_port; - address = ipv4_network_address{ip, port}; - return true; - } - return false; - } + bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0); + /************************************************************************/ /* */ /************************************************************************/ @@ -309,21 +295,8 @@ namespace net_utils //some helpers - inline - std::string print_connection_context(const connection_context_base& ctx) - { - std::stringstream ss; - ss << ctx.m_remote_address.str() << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT"); - return ss.str(); - } - - inline - std::string print_connection_context_short(const connection_context_base& ctx) - { - std::stringstream ss; - ss << ctx.m_remote_address.str() << (ctx.m_is_income ? " INC":" OUT"); - return ss.str(); - } + std::string print_connection_context(const connection_context_base& ctx); + std::string print_connection_context_short(const connection_context_base& ctx); inline MAKE_LOGGABLE(connection_context_base, ct, os) { diff --git a/src/p2p/network_throttle-detail.hpp b/contrib/epee/include/net/network_throttle-detail.hpp index 676d4341a..dba15a5ed 100644 --- a/src/p2p/network_throttle-detail.hpp +++ b/contrib/epee/include/net/network_throttle-detail.hpp @@ -33,8 +33,8 @@ /* rfree: throttle details, implementing rate limiting */ -#ifndef INCLUDED_src_p2p_throttle_detail_hpp -#define INCLUDED_src_p2p_throttle_detail_hpp +#ifndef INCLUDED_throttle_detail_hpp +#define INCLUDED_throttle_detail_hpp #include "network_throttle.hpp" diff --git a/src/p2p/network_throttle.hpp b/contrib/epee/include/net/network_throttle.hpp index bf1f93859..464b34726 100644 --- a/src/p2p/network_throttle.hpp +++ b/contrib/epee/include/net/network_throttle.hpp @@ -34,8 +34,8 @@ /* rfree: also includes the manager for singeton/global such objects */ -#ifndef INCLUDED_p2p_network_throttle_hpp -#define INCLUDED_p2p_network_throttle_hpp +#ifndef INCLUDED_network_throttle_hpp +#define INCLUDED_network_throttle_hpp #include <boost/asio.hpp> #include <string> diff --git a/contrib/epee/include/profile_tools.h b/contrib/epee/include/profile_tools.h index f285fe48b..a0b5f77f4 100644 --- a/contrib/epee/include/profile_tools.h +++ b/contrib/epee/include/profile_tools.h @@ -28,6 +28,8 @@ #ifndef _PROFILE_TOOLS_H_ #define _PROFILE_TOOLS_H_ +#include "misc_os_dependent.h" + namespace epee { diff --git a/contrib/epee/include/readline_buffer.h b/contrib/epee/include/readline_buffer.h index cda7e34f9..87c8826cb 100644 --- a/contrib/epee/include/readline_buffer.h +++ b/contrib/epee/include/readline_buffer.h @@ -2,9 +2,7 @@ #include <streambuf> #include <sstream> -#include <iostream> #include <vector> -#include <algorithm> namespace rdln { diff --git a/contrib/epee/include/reg_exp_definer.h b/contrib/epee/include/reg_exp_definer.h index e2bed5c3f..eb11c9e10 100644 --- a/contrib/epee/include/reg_exp_definer.h +++ b/contrib/epee/include/reg_exp_definer.h @@ -29,7 +29,7 @@ #define _REG_EXP_DEFINER_H_ #include <boost/interprocess/detail/atomic.hpp> - +#include "syncobj.h" namespace epee { diff --git a/contrib/epee/include/serialization/keyvalue_serialization_overloads.h b/contrib/epee/include/serialization/keyvalue_serialization_overloads.h index 2e020b136..7087136cc 100644 --- a/contrib/epee/include/serialization/keyvalue_serialization_overloads.h +++ b/contrib/epee/include/serialization/keyvalue_serialization_overloads.h @@ -26,6 +26,13 @@ #pragma once +#include <set> +#include <list> +#include <vector> +#include <deque> +#include <boost/mpl/vector.hpp> +#include <boost/mpl/contains_fwd.hpp> + namespace epee { namespace serialization diff --git a/contrib/epee/include/storages/portable_storage_from_json.h b/contrib/epee/include/storages/portable_storage_from_json.h index 04b57376c..727f36552 100644 --- a/contrib/epee/include/storages/portable_storage_from_json.h +++ b/contrib/epee/include/storages/portable_storage_from_json.h @@ -25,6 +25,8 @@ // #pragma once +#include <boost/lexical_cast.hpp> +#include <boost/algorithm/string/predicate.hpp> #include "parserse_base_utils.h" #include "file_io_utils.h" diff --git a/contrib/epee/include/storages/portable_storage_to_bin.h b/contrib/epee/include/storages/portable_storage_to_bin.h index 38e9f9098..9501bbc2a 100644 --- a/contrib/epee/include/storages/portable_storage_to_bin.h +++ b/contrib/epee/include/storages/portable_storage_to_bin.h @@ -28,6 +28,7 @@ #pragma once +#include "pragma_comp_defs.h" #include "misc_language.h" #include "portable_storage_base.h" diff --git a/contrib/epee/include/storages/portable_storage_val_converters.h b/contrib/epee/include/storages/portable_storage_val_converters.h index f4a16cfae..52aa09eba 100644 --- a/contrib/epee/include/storages/portable_storage_val_converters.h +++ b/contrib/epee/include/storages/portable_storage_val_converters.h @@ -28,7 +28,7 @@ #pragma once -#include <regex> +#include <boost/regex.hpp> #include "misc_language.h" #include "portable_storage_base.h" @@ -146,7 +146,7 @@ POP_WARNINGS if(std::all_of(from.begin(), from.end(), ::isdigit)) to = boost::lexical_cast<uint64_t>(from); // MyMonero ISO 8061 timestamp (2017-05-06T16:27:06Z) - else if (std::regex_match (from, std::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ"))) + else if (boost::regex_match (from, boost::regex("\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\dZ"))) { // Convert to unix timestamp std::tm tm = {}; diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h index 25639263c..307323aa1 100644 --- a/contrib/epee/include/string_tools.h +++ b/contrib/epee/include/string_tools.h @@ -35,15 +35,15 @@ # include <windows.h> #endif +#include <string.h> #include <locale> #include <cstdlib> #include <string> #include <type_traits> -#include <regex> #include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid_io.hpp> #include <boost/lexical_cast.hpp> -#include <boost/algorithm/string.hpp> +#include <boost/algorithm/string/predicate.hpp> #include "hex.h" #include "span.h" #include "warnings.h" @@ -350,11 +350,8 @@ POP_WARNINGS s = *(t_pod_type*)bin_buff.data(); return true; } - //---------------------------------------------------------------------------- - inline bool validate_hex(uint64_t length, const std::string& str) - { - return std::regex_match(str, std::regex("'^[0-9abcdefABCDEF]+$'")) && str.size() == length; - } + //---------------------------------------------------------------------------- + bool validate_hex(uint64_t length, const std::string& str); //---------------------------------------------------------------------------- inline std::string get_extension(const std::string& str) { diff --git a/contrib/epee/src/CMakeLists.txt b/contrib/epee/src/CMakeLists.txt index 5cd6d7813..b6967e8fc 100644 --- a/contrib/epee/src/CMakeLists.txt +++ b/contrib/epee/src/CMakeLists.txt @@ -26,7 +26,8 @@ # 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. -add_library(epee STATIC hex.cpp http_auth.cpp mlog.cpp net_utils_base.cpp string_tools.cpp wipeable_string.cpp) +add_library(epee STATIC hex.cpp http_auth.cpp mlog.cpp net_utils_base.cpp string_tools.cpp wipeable_string.cpp + connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp) if (USE_READLINE AND GNU_READLINE_FOUND) add_library(epee_readline STATIC readline_buffer.cpp) endif() diff --git a/src/p2p/connection_basic.cpp b/contrib/epee/src/connection_basic.cpp index 06baa7893..534044a79 100644 --- a/src/p2p/connection_basic.cpp +++ b/contrib/epee/src/connection_basic.cpp @@ -32,7 +32,7 @@ /* rfree: implementation for the non-template base, can be used by connection<> template class in abstract_tcp_server2 file */ -#include "connection_basic.hpp" +#include "net/connection_basic.hpp" #include <boost/asio.hpp> #include <string> @@ -77,7 +77,7 @@ #include "net/abstract_tcp_server2.h" // TODO: -#include "network_throttle-detail.hpp" +#include "net/network_throttle-detail.hpp" #include "cryptonote_core/cryptonote_core.h" #undef MONERO_DEFAULT_LOG_CATEGORY diff --git a/contrib/epee/src/mlog.cpp b/contrib/epee/src/mlog.cpp index 74b7dd2f4..a30efbc6a 100644 --- a/contrib/epee/src/mlog.cpp +++ b/contrib/epee/src/mlog.cpp @@ -28,7 +28,11 @@ #ifndef _MLOG_H_ #define _MLOG_H_ +#include <time.h> #include <atomic> +#include <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> +#include "string_tools.h" #include "misc_log_ex.h" #undef MONERO_DEFAULT_LOG_CATEGORY diff --git a/contrib/epee/src/net_utils_base.cpp b/contrib/epee/src/net_utils_base.cpp index 22afcf819..2f4015e81 100644 --- a/contrib/epee/src/net_utils_base.cpp +++ b/contrib/epee/src/net_utils_base.cpp @@ -1,5 +1,6 @@ #include "net/net_utils_base.h" +#include "string_tools.h" #include <cstring> #include <typeindex> @@ -56,5 +57,34 @@ namespace epee { namespace net_utils if (typeid(*self_) != typeid(*other_self)) return false; return self_->is_same_host(*other_self); } + + bool create_network_address(network_address &address, const std::string &string, uint16_t default_port) + { + uint32_t ip; + uint16_t port; + if (epee::string_tools::parse_peer_from_string(ip, port, string)) + { + if (default_port && !port) + port = default_port; + address = ipv4_network_address{ip, port}; + return true; + } + return false; + } + + std::string print_connection_context(const connection_context_base& ctx) + { + std::stringstream ss; + ss << ctx.m_remote_address.str() << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT"); + return ss.str(); + } + + std::string print_connection_context_short(const connection_context_base& ctx) + { + std::stringstream ss; + ss << ctx.m_remote_address.str() << (ctx.m_is_income ? " INC":" OUT"); + return ss.str(); + } + }} diff --git a/src/p2p/network_throttle-detail.cpp b/contrib/epee/src/network_throttle-detail.cpp index 651e01e6b..317dde8e0 100644 --- a/src/p2p/network_throttle-detail.cpp +++ b/contrib/epee/src/network_throttle-detail.cpp @@ -74,7 +74,7 @@ #include "net/abstract_tcp_server2.h" // TODO: -#include "network_throttle-detail.hpp" +#include "net/network_throttle-detail.hpp" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "net.throttle" diff --git a/src/p2p/network_throttle.cpp b/contrib/epee/src/network_throttle.cpp index 74b20376d..afacc3e96 100644 --- a/src/p2p/network_throttle.cpp +++ b/contrib/epee/src/network_throttle.cpp @@ -54,7 +54,7 @@ Throttling work by: // 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. -#include "network_throttle-detail.hpp" +#include "net/network_throttle-detail.hpp" namespace epee { diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp index 291bba94c..00c2ddd62 100644 --- a/contrib/epee/src/readline_buffer.cpp +++ b/contrib/epee/src/readline_buffer.cpp @@ -3,6 +3,7 @@ #include <readline/history.h> #include <sys/select.h> #include <unistd.h> +#include <iostream> #include <boost/thread.hpp> #include <boost/algorithm/string.hpp> diff --git a/contrib/epee/src/string_tools.cpp b/contrib/epee/src/string_tools.cpp index d04b16b75..fd0254016 100644 --- a/contrib/epee/src/string_tools.cpp +++ b/contrib/epee/src/string_tools.cpp @@ -26,6 +26,8 @@ #include "string_tools.h" +#include <ctype.h> + #ifdef _WIN32 # include <winsock2.h> #else @@ -56,6 +58,16 @@ namespace string_tools return true; } + //---------------------------------------------------------------------------- + bool validate_hex(uint64_t length, const std::string& str) + { + if (str.size() != length) + return false; + for (char c: str) + if (!isxdigit(c)) + return false; + return true; + } } } diff --git a/src/blockchain_db/berkeleydb/db_bdb.h b/src/blockchain_db/berkeleydb/db_bdb.h index a040a70ef..dd78d951f 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.h +++ b/src/blockchain_db/berkeleydb/db_bdb.h @@ -28,7 +28,7 @@ #include <db_cxx.h> #include "blockchain_db/blockchain_db.h" -#include "cryptonote_protocol/blobdatatype.h" // for type blobdata +#include "cryptonote_basic/blobdatatype.h" // for type blobdata #include <unordered_map> #include <condition_variable> diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp index 2fb43a4ba..07b2451b0 100644 --- a/src/blockchain_db/blockchain_db.cpp +++ b/src/blockchain_db/blockchain_db.cpp @@ -28,6 +28,7 @@ #include <boost/range/adaptor/reversed.hpp> +#include "string_tools.h" #include "blockchain_db.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "profile_tools.h" diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 79676b808..88034a927 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -36,7 +36,7 @@ #include <boost/program_options.hpp> #include "common/command_line.h" #include "crypto/hash.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/difficulty.h" #include "cryptonote_basic/hardfork.h" diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 865558e07..07a0e67b1 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -34,6 +34,7 @@ #include <cstring> // memcpy #include <random> +#include "string_tools.h" #include "common/util.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "crypto/crypto.h" diff --git a/src/blockchain_db/lmdb/db_lmdb.h b/src/blockchain_db/lmdb/db_lmdb.h index fce8f29ed..85b62b5db 100644 --- a/src/blockchain_db/lmdb/db_lmdb.h +++ b/src/blockchain_db/lmdb/db_lmdb.h @@ -29,7 +29,7 @@ #include <atomic> #include "blockchain_db/blockchain_db.h" -#include "cryptonote_protocol/blobdatatype.h" // for type blobdata +#include "cryptonote_basic/blobdatatype.h" // for type blobdata #include "ringct/rctTypes.h" #include <boost/thread/tss.hpp> diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index a50b0bad6..70d1dd696 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -32,6 +32,7 @@ #include <fstream> #include <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> #include "misc_log_ex.h" #include "bootstrap_file.h" #include "bootstrap_serialization.h" diff --git a/src/blockchain_utilities/blocksdat_file.h b/src/blockchain_utilities/blocksdat_file.h index d43811772..3fa3ee29e 100644 --- a/src/blockchain_utilities/blocksdat_file.h +++ b/src/blockchain_utilities/blocksdat_file.h @@ -31,8 +31,9 @@ #include <boost/iostreams/stream_buffer.hpp> #include <boost/iostreams/stream.hpp> #include <boost/iostreams/device/back_inserter.hpp> - #include <boost/iostreams/filtering_streambuf.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_boost_serialization.h" diff --git a/src/blockchain_utilities/bootstrap_file.h b/src/blockchain_utilities/bootstrap_file.h index 0926ee2e5..63914dc26 100644 --- a/src/blockchain_utilities/bootstrap_file.h +++ b/src/blockchain_utilities/bootstrap_file.h @@ -31,8 +31,9 @@ #include <boost/iostreams/stream_buffer.hpp> #include <boost/iostreams/stream.hpp> #include <boost/iostreams/device/back_inserter.hpp> - #include <boost/iostreams/filtering_streambuf.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_core/blockchain.h" diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index 9be08958c..c66c4f5d6 100644 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -36,15 +36,38 @@ using namespace epee; #include "common/dns_utils.h" #include "include_base_utils.h" +#include "string_tools.h" #include "storages/portable_storage_template_helper.h" // epee json include -#include <sstream> -#include <random> +#include "serialization/keyvalue_serialization.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "checkpoints" namespace cryptonote { + /** + * @brief struct for loading a checkpoint from json + */ + struct t_hashline + { + uint64_t height; //!< the height of the checkpoint + std::string hash; //!< the hash for the checkpoint + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(height) + KV_SERIALIZE(hash) + END_KV_SERIALIZE_MAP() + }; + + /** + * @brief struct for loading many checkpoints from json + */ + struct t_hash_json { + std::vector<t_hashline> hashlines; //!< the checkpoint lines from the file + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(hashlines) + END_KV_SERIALIZE_MAP() + }; + //--------------------------------------------------------------------------- checkpoints::checkpoints() { diff --git a/src/checkpoints/checkpoints.h b/src/checkpoints/checkpoints.h index a643c5790..3e034f6f0 100644 --- a/src/checkpoints/checkpoints.h +++ b/src/checkpoints/checkpoints.h @@ -33,7 +33,6 @@ #include <vector> #include "misc_log_ex.h" #include "crypto/hash.h" -#include "serialization/keyvalue_serialization.h" #define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false); #define JSON_HASH_FILE_NAME "checkpoints.json" @@ -187,32 +186,7 @@ namespace cryptonote bool load_checkpoints_from_dns(bool testnet = false); private: - - - /** - * @brief struct for loading a checkpoint from json - */ - struct t_hashline - { - uint64_t height; //!< the height of the checkpoint - std::string hash; //!< the hash for the checkpoint - BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(height) - KV_SERIALIZE(hash) - END_KV_SERIALIZE_MAP() - }; - - /** - * @brief struct for loading many checkpoints from json - */ - struct t_hash_json { - std::vector<t_hashline> hashlines; //!< the checkpoint lines from the file - BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(hashlines) - END_KV_SERIALIZE_MAP() - }; - std::map<uint64_t, crypto::hash> m_points; //!< the checkpoints container - }; + } diff --git a/src/common/boost_serialization_helper.h b/src/common/boost_serialization_helper.h index 4a503d830..f8b21c52e 100644 --- a/src/common/boost_serialization_helper.h +++ b/src/common/boost_serialization_helper.h @@ -33,6 +33,7 @@ #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/portable_binary_oarchive.hpp> #include <boost/archive/portable_binary_iarchive.hpp> +#include <boost/filesystem/operations.hpp> namespace tools diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index f549218cb..d942ae9d0 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -34,6 +34,8 @@ #include "include_base_utils.h" #include <random> #include <boost/filesystem/fstream.hpp> +#include <boost/thread/mutex.hpp> +#include <boost/thread/thread.hpp> using namespace epee; namespace bf = boost::filesystem; diff --git a/src/common/perf_timer.cpp b/src/common/perf_timer.cpp index 3b68485d9..4947058d3 100644 --- a/src/common/perf_timer.cpp +++ b/src/common/perf_timer.cpp @@ -26,6 +26,8 @@ // 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. +#include <vector> +#include "misc_os_dependent.h" #include "perf_timer.h" #undef MONERO_DEFAULT_LOG_CATEGORY @@ -35,7 +37,8 @@ namespace tools { el::Level performance_timer_log_level = el::Level::Debug; -__thread std::vector<PerformanceTimer*> *performance_timers = NULL; + +static __thread std::vector<PerformanceTimer*> *performance_timers = NULL; void set_performance_timer_log_level(el::Level level) { @@ -48,4 +51,38 @@ void set_performance_timer_log_level(el::Level level) performance_timer_log_level = level; } +PerformanceTimer::PerformanceTimer(const std::string &s, uint64_t unit, el::Level l): name(s), unit(unit), level(l), started(false) +{ + ticks = epee::misc_utils::get_ns_count(); + if (!performance_timers) + { + MLOG(level, "PERF ----------"); + performance_timers = new std::vector<PerformanceTimer*>(); + } + else + { + PerformanceTimer *pt = performance_timers->back(); + if (!pt->started) + { + MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name); + pt->started = true; + } + } + performance_timers->push_back(this); +} + +PerformanceTimer::~PerformanceTimer() +{ + performance_timers->pop_back(); + ticks = epee::misc_utils::get_ns_count() - ticks; + char s[12]; + snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit)); + MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name); + if (performance_timers->empty()) + { + delete performance_timers; + performance_timers = NULL; + } +} + } diff --git a/src/common/perf_timer.h b/src/common/perf_timer.h index 4d7d99afb..a1d71609c 100644 --- a/src/common/perf_timer.h +++ b/src/common/perf_timer.h @@ -41,44 +41,12 @@ namespace tools class PerformanceTimer; extern el::Level performance_timer_log_level; -extern __thread std::vector<PerformanceTimer*> *performance_timers; class PerformanceTimer { public: - PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug): name(s), unit(unit), level(l), started(false) - { - ticks = epee::misc_utils::get_ns_count(); - if (!performance_timers) - { - MLOG(level, "PERF ----------"); - performance_timers = new std::vector<PerformanceTimer*>(); - } - else - { - PerformanceTimer *pt = performance_timers->back(); - if (!pt->started) - { - MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name); - pt->started = true; - } - } - performance_timers->push_back(this); - } - - ~PerformanceTimer() - { - performance_timers->pop_back(); - ticks = epee::misc_utils::get_ns_count() - ticks; - char s[12]; - snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit)); - MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name); - if (performance_timers->empty()) - { - delete performance_timers; - performance_timers = NULL; - } - } + PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug); + ~PerformanceTimer(); private: std::string name; diff --git a/src/common/stack_trace.cpp b/src/common/stack_trace.cpp index 6fdf4dd47..bcdf72b60 100644 --- a/src/common/stack_trace.cpp +++ b/src/common/stack_trace.cpp @@ -39,6 +39,7 @@ #ifndef STATICLIB #include <dlfcn.h> #endif +#include <boost/algorithm/string.hpp> #include "common/stack_trace.h" #include "misc_log_ex.h" diff --git a/src/common/updates.cpp b/src/common/updates.cpp index 141330c2c..eff6754af 100644 --- a/src/common/updates.cpp +++ b/src/common/updates.cpp @@ -26,6 +26,7 @@ // 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. +#include <boost/algorithm/string.hpp> #include "misc_log_ex.h" #include "util.h" #include "dns_utils.h" diff --git a/src/common/util.cpp b/src/common/util.cpp index de19fec81..d9e12ffe4 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -54,6 +54,7 @@ using namespace epee; #include <sys/stat.h> #endif #include <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> #include <boost/asio.hpp> #include <openssl/sha.h> diff --git a/src/cryptonote_protocol/blobdatatype.h b/src/cryptonote_basic/blobdatatype.h index 2d12a84af..2d12a84af 100644 --- a/src/cryptonote_protocol/blobdatatype.h +++ b/src/cryptonote_basic/blobdatatype.h diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp index 6759f1826..a22c3bdea 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.cpp +++ b/src/cryptonote_basic/cryptonote_format_utils.cpp @@ -32,7 +32,9 @@ using namespace epee; #include <atomic> +#include <boost/algorithm/string.hpp> #include "wipeable_string.h" +#include "string_tools.h" #include "cryptonote_format_utils.h" #include "cryptonote_config.h" #include "crypto/crypto.h" diff --git a/src/cryptonote_basic/cryptonote_format_utils.h b/src/cryptonote_basic/cryptonote_format_utils.h index 714d80195..cabdb1f5c 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.h +++ b/src/cryptonote_basic/cryptonote_format_utils.h @@ -29,7 +29,7 @@ // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers #pragma once -#include "cryptonote_protocol/cryptonote_protocol_defs.h" +#include "blobdatatype.h" #include "cryptonote_basic_impl.h" #include "account.h" #include "subaddress_index.h" diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index c90ab0f03..670baea50 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -32,14 +32,17 @@ #include <numeric> #include <boost/utility/value_init.hpp> #include <boost/interprocess/detail/atomic.hpp> +#include <boost/algorithm/string.hpp> #include <boost/limits.hpp> -#include "misc_language.h" #include "include_base_utils.h" +#include "misc_language.h" +#include "syncobj.h" #include "cryptonote_basic_impl.h" #include "cryptonote_format_utils.h" #include "file_io_utils.h" #include "common/command_line.h" #include "string_coding.h" +#include "string_tools.h" #include "storages/portable_storage_template_helper.h" #include "boost/logic/tribool.hpp" diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 04f1e46a7..960a07832 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -28,7 +28,10 @@ // // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers +#include <boost/algorithm/string.hpp> + #include "include_base_utils.h" +#include "string_tools.h" using namespace epee; #include <unordered_set> @@ -45,11 +48,11 @@ using namespace epee; #include "cryptonote_tx_utils.h" #include "misc_language.h" #include <csignal> -#include <p2p/net_node.h> #include "checkpoints/checkpoints.h" #include "ringct/rctTypes.h" #include "blockchain_db/blockchain_db.h" #include "ringct/rctSigs.h" +#include "version.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "cn" @@ -233,10 +236,6 @@ namespace cryptonote command_line::add_arg(desc, arg_test_dbg_lock_sleep); command_line::add_arg(desc, arg_offline); - // we now also need some of net_node's options (p2p bind arg, for separate data dir) - command_line::add_arg(desc, nodetool::arg_testnet_p2p_bind_port, false); - command_line::add_arg(desc, nodetool::arg_p2p_bind_port, false); - miner::init_options(desc); BlockchainDB::init_options(desc); } @@ -335,21 +334,17 @@ namespace cryptonote return m_blockchain_storage.get_alternative_blocks_count(); } //----------------------------------------------------------------------------------------------- - bool core::init(const boost::program_options::variables_map& vm, const cryptonote::test_options *test_options) + bool core::init(const boost::program_options::variables_map& vm, const char *config_subdir, const cryptonote::test_options *test_options) { start_time = std::time(nullptr); m_fakechain = test_options != NULL; bool r = handle_command_line(vm); bool testnet = command_line::get_arg(vm, arg_testnet_on); - auto p2p_bind_arg = testnet ? nodetool::arg_testnet_p2p_bind_port : nodetool::arg_p2p_bind_port; - std::string m_port = command_line::get_arg(vm, p2p_bind_arg); std::string m_config_folder_mempool = m_config_folder; - if ((!testnet && m_port != std::to_string(::config::P2P_DEFAULT_PORT)) - || (testnet && m_port != std::to_string(::config::testnet::P2P_DEFAULT_PORT))) { - m_config_folder_mempool = m_config_folder_mempool + "/" + m_port; - } + if (config_subdir) + m_config_folder_mempool = m_config_folder_mempool + "/" + config_subdir; std::string db_type = command_line::get_arg(vm, cryptonote::arg_db_type); std::string db_sync_mode = command_line::get_arg(vm, cryptonote::arg_db_sync_mode); diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index 6cb4fc938..9f84ed303 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -36,7 +36,6 @@ #include <boost/program_options/variables_map.hpp> #include <boost/interprocess/sync/file_lock.hpp> -#include "p2p/net_node_common.h" #include "cryptonote_protocol/cryptonote_protocol_handler_common.h" #include "storages/portable_storage_template_helper.h" #include "common/download.h" @@ -242,11 +241,12 @@ namespace cryptonote * a miner instance with parameters given on the command line (or defaults) * * @param vm command line parameters + * @param config_subdir subdirectory for config storage * @param test_options configuration options for testing * * @return false if one of the init steps fails, otherwise true */ - bool init(const boost::program_options::variables_map& vm, const test_options *test_options = NULL); + bool init(const boost::program_options::variables_map& vm, const char *config_subdir = NULL, const test_options *test_options = NULL); /** * @copydoc Blockchain::reset_and_set_genesis_block diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index 4afa669fd..662420bef 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -30,6 +30,7 @@ #include <unordered_set> #include "include_base_utils.h" +#include "string_tools.h" using namespace epee; #include "common/apply_permutation.h" diff --git a/src/cryptonote_protocol/block_queue.cpp b/src/cryptonote_protocol/block_queue.cpp index 813167400..bfff35456 100644 --- a/src/cryptonote_protocol/block_queue.cpp +++ b/src/cryptonote_protocol/block_queue.cpp @@ -31,6 +31,7 @@ #include <vector> #include <unordered_map> #include <boost/uuid/nil_generator.hpp> +#include "string_tools.h" #include "cryptonote_protocol_defs.h" #include "block_queue.h" diff --git a/src/cryptonote_protocol/cryptonote_protocol_defs.h b/src/cryptonote_protocol/cryptonote_protocol_defs.h index 7cf7e4a4d..fc2f4c343 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_defs.h +++ b/src/cryptonote_protocol/cryptonote_protocol_defs.h @@ -33,7 +33,7 @@ #include <list> #include "serialization/keyvalue_serialization.h" #include "cryptonote_basic/cryptonote_basic.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" namespace cryptonote { diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp b/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp index 094e4fc95..578abd20c 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp +++ b/src/cryptonote_protocol/cryptonote_protocol_handler-base.cpp @@ -70,7 +70,7 @@ #include <boost/asio/ip/unicast.hpp> #include "cryptonote_protocol_handler.h" -#include "p2p/network_throttle.hpp" +#include "net/network_throttle.hpp" #include "cryptonote_core/cryptonote_core.h" // e.g. for the send_stop_signal() diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h index d54687e6a..f61caf69b 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.h +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h @@ -36,7 +36,6 @@ #include <boost/program_options/variables_map.hpp> #include <string> -#include <ctime> #include "math_helper.h" #include "storages/levin_abstract_invoke2.h" @@ -46,8 +45,6 @@ #include "block_queue.h" #include "cryptonote_basic/connection_context.h" #include "cryptonote_basic/cryptonote_stat_info.h" -#include "cryptonote_basic/verification_context.h" -// #include <netinet/in.h> #include <boost/circular_buffer.hpp> PUSH_WARNINGS @@ -173,7 +170,4 @@ namespace cryptonote } // namespace - -#include "cryptonote_protocol_handler.inl" - POP_WARNINGS diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 48ab1eadf..389e8ba84 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -37,11 +37,11 @@ #include <boost/interprocess/detail/atomic.hpp> #include <list> -#include <unordered_map> +#include <ctime> #include "cryptonote_basic/cryptonote_format_utils.h" #include "profile_tools.h" -#include "p2p/network_throttle-detail.hpp" +#include "net/network_throttle-detail.hpp" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "net.cn" @@ -1561,7 +1561,7 @@ skip: size_t t_cryptonote_protocol_handler<t_core>::get_synchronizing_connections_count() { size_t count = 0; - m_p2p->for_each_connection([&](cryptonote_connection_context& context, nodetool::peerid_type peer_id)->bool{ + m_p2p->for_each_connection([&](cryptonote_connection_context& context, nodetool::peerid_type peer_id, uint32_t support_flags)->bool{ if(context.m_state == cryptonote_connection_context::state_synchronizing) ++count; return true; diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index 2f9c2b2f9..ad84db450 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -59,7 +59,6 @@ set(daemon_private_headers rpc_command_executor.h # cryptonote_protocol - ../cryptonote_protocol/blobdatatype.h ../cryptonote_protocol/cryptonote_protocol_defs.h ../cryptonote_protocol/cryptonote_protocol_handler.h ../cryptonote_protocol/cryptonote_protocol_handler.inl @@ -67,7 +66,6 @@ set(daemon_private_headers # p2p ../p2p/net_node.h - ../p2p/net_node.inl ../p2p/net_node_common.h ../p2p/net_peerlist.h ../p2p/net_peerlist_boost_serialization.h diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp index 7ff6b2bf3..ecf58e22c 100644 --- a/src/daemon/command_server.cpp +++ b/src/daemon/command_server.cpp @@ -26,8 +26,10 @@ // 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. +#include <boost/algorithm/string.hpp> #include "cryptonote_config.h" #include "version.h" +#include "string_tools.h" #include "daemon/command_server.h" #undef MONERO_DEFAULT_LOG_CATEGORY diff --git a/src/daemon/core.h b/src/daemon/core.h index 9e6ff5e29..97f1cb8c1 100644 --- a/src/daemon/core.h +++ b/src/daemon/core.h @@ -67,11 +67,24 @@ public: m_core.set_cryptonote_protocol(&protocol); } + std::string get_config_subdir() const + { + bool testnet = command_line::get_arg(m_vm_HACK, cryptonote::arg_testnet_on); + auto p2p_bind_arg = testnet ? nodetool::arg_testnet_p2p_bind_port : nodetool::arg_p2p_bind_port; + std::string port = command_line::get_arg(m_vm_HACK, p2p_bind_arg); + if ((!testnet && port != std::to_string(::config::P2P_DEFAULT_PORT)) + || (testnet && port != std::to_string(::config::testnet::P2P_DEFAULT_PORT))) { + return port; + } + return std::string(); + } + bool run() { //initialize core here MGINFO("Initializing core..."); - if (!m_core.init(m_vm_HACK)) + std::string config_subdir = get_config_subdir(); + if (!m_core.init(m_vm_HACK, config_subdir.empty() ? NULL : config_subdir.c_str())) { return false; } diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index f8acf1357..3bc6ea392 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -30,6 +30,7 @@ #include <memory> #include <stdexcept> +#include <boost/algorithm/string/split.hpp> #include "misc_log_ex.h" #include "daemon/daemon.h" #include "rpc/daemon_handler.h" diff --git a/src/daemon/executor.h b/src/daemon/executor.h index 137e7209c..35c9e9b47 100644 --- a/src/daemon/executor.h +++ b/src/daemon/executor.h @@ -32,7 +32,6 @@ #include <boost/program_options/options_description.hpp> #include <boost/program_options/variables_map.hpp> #include <string> -#include <vector> #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "daemon" diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index d038cc825..6ac47fcb2 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -44,6 +44,7 @@ #include "rpc/rpc_args.h" #include "daemon/command_line_args.h" #include "blockchain_db/db_types.h" +#include "version.h" #ifdef STACK_TRACE #include "common/stack_trace.h" diff --git a/src/debug_utilities/cn_deserialize.cpp b/src/debug_utilities/cn_deserialize.cpp index 7235ef855..a59c04dc6 100644 --- a/src/debug_utilities/cn_deserialize.cpp +++ b/src/debug_utilities/cn_deserialize.cpp @@ -26,6 +26,7 @@ // 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. +#include <boost/filesystem.hpp> #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/tx_extra.h" #include "cryptonote_core/blockchain.h" diff --git a/src/debug_utilities/object_sizes.cpp b/src/debug_utilities/object_sizes.cpp index e58da7395..82d8a4add 100644 --- a/src/debug_utilities/object_sizes.cpp +++ b/src/debug_utilities/object_sizes.cpp @@ -31,7 +31,7 @@ #include "cryptonote_basic/tx_extra.h" #include "cryptonote_core/blockchain.h" #include "p2p/p2p_protocol_defs.h" -#include "p2p/connection_basic.hpp" +#include "net/connection_basic.hpp" #include "p2p/net_peerlist.h" #include "p2p/net_node.h" #include "cryptonote_protocol/cryptonote_protocol_handler.h" diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp new file mode 100644 index 000000000..4ea08a1f8 --- /dev/null +++ b/src/p2p/net_node.cpp @@ -0,0 +1,65 @@ +// Copyright (c) 2014-2017, 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 + +#include "common/command_line.h" +#include "net_node.h" + +namespace nodetool +{ + const command_line::arg_descriptor<std::string> arg_p2p_bind_ip = {"p2p-bind-ip", "Interface for p2p network protocol", "0.0.0.0"}; + const command_line::arg_descriptor<std::string> arg_p2p_bind_port = { + "p2p-bind-port" + , "Port for p2p network protocol" + , std::to_string(config::P2P_DEFAULT_PORT) + }; + const command_line::arg_descriptor<std::string> arg_testnet_p2p_bind_port = { + "testnet-p2p-bind-port" + , "Port for testnet p2p network protocol" + , std::to_string(config::testnet::P2P_DEFAULT_PORT) + }; + const command_line::arg_descriptor<uint32_t> arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0}; + const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"}; + const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_peer = {"add-peer", "Manually add peer to local peerlist"}; + const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_priority_node = {"add-priority-node", "Specify list of peers to connect to and attempt to keep the connection open"}; + const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_exclusive_node = {"add-exclusive-node", "Specify list of peers to connect to only." + " If this option is given the options add-priority-node and seed-node are ignored"}; + const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_seed_node = {"seed-node", "Connect to a node to retrieve peer addresses, and disconnect"}; + const command_line::arg_descriptor<bool> arg_p2p_hide_my_port = {"hide-my-port", "Do not announce yourself as peerlist candidate", false, true}; + + const command_line::arg_descriptor<bool> arg_no_igd = {"no-igd", "Disable UPnP port mapping"}; + const command_line::arg_descriptor<int64_t> arg_out_peers = {"out-peers", "set max number of out peers", -1}; + const command_line::arg_descriptor<int> arg_tos_flag = {"tos-flag", "set TOS flag", -1}; + + const command_line::arg_descriptor<int64_t> arg_limit_rate_up = {"limit-rate-up", "set limit-rate-up [kB/s]", -1}; + const command_line::arg_descriptor<int64_t> arg_limit_rate_down = {"limit-rate-down", "set limit-rate-down [kB/s]", -1}; + const command_line::arg_descriptor<int64_t> arg_limit_rate = {"limit-rate", "set limit-rate [kB/s]", -1}; + + const command_line::arg_descriptor<bool> arg_save_graph = {"save-graph", "Save data for dr monero", false}; +} diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 8bbaa9138..294ccde9e 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -30,13 +30,6 @@ #pragma once #include <boost/thread.hpp> -#include <boost/bind.hpp> -#include <boost/bimap.hpp> -#include <boost/multi_index_container.hpp> -#include <boost/multi_index/ordered_index.hpp> -#include <boost/multi_index/identity.hpp> -#include <boost/multi_index/member.hpp> -#include <boost/multi_index/global_fun.hpp> #include <boost/program_options/options_description.hpp> #include <boost/program_options/variables_map.hpp> #include <boost/serialization/version.hpp> @@ -335,8 +328,30 @@ namespace nodetool bool m_testnet; }; -} -#include "net_node.inl" + const int64_t default_limit_up = 2048; + const int64_t default_limit_down = 8192; + extern const command_line::arg_descriptor<std::string> arg_p2p_bind_ip; + extern const command_line::arg_descriptor<std::string> arg_p2p_bind_port; + extern const command_line::arg_descriptor<std::string> arg_testnet_p2p_bind_port; + extern const command_line::arg_descriptor<uint32_t> arg_p2p_external_port; + extern const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip; + extern const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_peer; + extern const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_priority_node; + extern const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_exclusive_node; + extern const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_seed_node; + extern const command_line::arg_descriptor<bool> arg_p2p_hide_my_port; + + extern const command_line::arg_descriptor<bool> arg_no_igd; + extern const command_line::arg_descriptor<bool> arg_offline; + extern const command_line::arg_descriptor<int64_t> arg_out_peers; + extern const command_line::arg_descriptor<int> arg_tos_flag; + + extern const command_line::arg_descriptor<int64_t> arg_limit_rate_up; + extern const command_line::arg_descriptor<int64_t> arg_limit_rate_down; + extern const command_line::arg_descriptor<int64_t> arg_limit_rate; + + extern const command_line::arg_descriptor<bool> arg_save_graph; +} POP_WARNINGS diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index c6792f138..55be7c2cb 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -30,11 +30,10 @@ // IP blocking adapted from Boolberry -#pragma once - #include <algorithm> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/thread/thread.hpp> +#include <boost/bind.hpp> #include <atomic> #include "version.h" @@ -70,40 +69,6 @@ namespace nodetool { - namespace - { - const int64_t default_limit_up = 2048; // kB/s - const int64_t default_limit_down = 8192; // kB/s - const command_line::arg_descriptor<std::string> arg_p2p_bind_ip = {"p2p-bind-ip", "Interface for p2p network protocol", "0.0.0.0"}; - const command_line::arg_descriptor<std::string> arg_p2p_bind_port = { - "p2p-bind-port" - , "Port for p2p network protocol" - , std::to_string(config::P2P_DEFAULT_PORT) - }; - const command_line::arg_descriptor<std::string> arg_testnet_p2p_bind_port = { - "testnet-p2p-bind-port" - , "Port for testnet p2p network protocol" - , std::to_string(config::testnet::P2P_DEFAULT_PORT) - }; - const command_line::arg_descriptor<uint32_t> arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0}; - const command_line::arg_descriptor<bool> arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"}; - const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_peer = {"add-peer", "Manually add peer to local peerlist"}; - const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_priority_node = {"add-priority-node", "Specify list of peers to connect to and attempt to keep the connection open"}; - const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_add_exclusive_node = {"add-exclusive-node", "Specify list of peers to connect to only." - " If this option is given the options add-priority-node and seed-node are ignored"}; - const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_seed_node = {"seed-node", "Connect to a node to retrieve peer addresses, and disconnect"}; - const command_line::arg_descriptor<bool> arg_p2p_hide_my_port = {"hide-my-port", "Do not announce yourself as peerlist candidate", false, true}; - - const command_line::arg_descriptor<bool> arg_no_igd = {"no-igd", "Disable UPnP port mapping"}; - const command_line::arg_descriptor<int64_t> arg_out_peers = {"out-peers", "set max number of out peers", -1}; - const command_line::arg_descriptor<int> arg_tos_flag = {"tos-flag", "set TOS flag", -1}; - - const command_line::arg_descriptor<int64_t> arg_limit_rate_up = {"limit-rate-up", "set limit-rate-up [kB/s]", -1}; - const command_line::arg_descriptor<int64_t> arg_limit_rate_down = {"limit-rate-down", "set limit-rate-down [kB/s]", -1}; - const command_line::arg_descriptor<int64_t> arg_limit_rate = {"limit-rate", "set limit-rate [kB/s]", -1}; - - const command_line::arg_descriptor<bool> arg_save_graph = {"save-graph", "Save data for dr monero", false}; - } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> void node_server<t_payload_net_handler>::init_options(boost::program_options::options_description& desc) diff --git a/src/p2p/net_peerlist.h b/src/p2p/net_peerlist.h index 8372445aa..8216e9be6 100644 --- a/src/p2p/net_peerlist.h +++ b/src/p2p/net_peerlist.h @@ -33,8 +33,6 @@ #include <list> #include <set> #include <map> -//#include <boost/bimap.hpp> -//#include <boost/bimap/multiset_of.hpp> #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/portable_binary_oarchive.hpp> #include <boost/archive/portable_binary_iarchive.hpp> diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h index d49d83989..181854e8e 100644 --- a/src/p2p/p2p_protocol_defs.h +++ b/src/p2p/p2p_protocol_defs.h @@ -34,6 +34,8 @@ #include "serialization/keyvalue_serialization.h" #include "net/net_utils_base.h" #include "misc_language.h" +#include "string_tools.h" +#include "time_helper.h" #include "cryptonote_config.h" #ifdef ALLOW_DEBUG_COMMANDS #include "crypto/crypto.h" diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index 8e94b52b3..a7311482c 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -28,6 +28,7 @@ // 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. +#include <boost/lexical_cast.hpp> #include "misc_log_ex.h" #include "rctOps.h" using namespace crypto; diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt index 23bb6aaae..748c6b8c1 100644 --- a/src/rpc/CMakeLists.txt +++ b/src/rpc/CMakeLists.txt @@ -26,9 +26,12 @@ # 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. +set(rpc_base_sources + rpc_args.cpp) + set(rpc_sources core_rpc_server.cpp - rpc_args.cpp) + instanciations) set(daemon_messages_sources message.cpp @@ -39,9 +42,11 @@ set(daemon_rpc_server_sources zmq_server.cpp) -set(rpc_headers +set(rpc_base_headers rpc_args.h) +set(rpc_headers) + set(daemon_rpc_server_headers) @@ -69,6 +74,11 @@ monero_private_headers(daemon_rpc_server ${daemon_rpc_server_private_headers}) +monero_add_library(rpc_base + ${rpc_base_sources} + ${rpc_base_headers} + ${rpc_base_private_headers}) + monero_add_library(rpc ${rpc_sources} ${rpc_headers} @@ -85,8 +95,18 @@ monero_add_library(daemon_rpc_server ${daemon_rpc_server_private_headers}) +target_link_libraries(rpc_base + PUBLIC + common + epee + ${Boost_REGEX_LIBRARY} + ${Boost_THREAD_LIBRARY} + PRIVATE + ${EXTRA_LIBRARIES}) + target_link_libraries(rpc PUBLIC + rpc_base common cryptonote_core cryptonote_protocol diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index c2206c89a..803588cbd 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -29,6 +29,7 @@ // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers #include "include_base_utils.h" +#include "string_tools.h" using namespace epee; #include "core_rpc_server.h" @@ -44,6 +45,8 @@ using namespace epee; #include "crypto/hash.h" #include "rpc/rpc_args.h" #include "core_rpc_server_error_codes.h" +#include "p2p/net_node.h" +#include "version.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "daemon.rpc" diff --git a/src/rpc/daemon_handler.cpp b/src/rpc/daemon_handler.cpp index 4d3fbf491..6643ce4e4 100644 --- a/src/rpc/daemon_handler.cpp +++ b/src/rpc/daemon_handler.cpp @@ -32,7 +32,7 @@ // but including here for clarity #include "cryptonote_core/cryptonote_core.h" #include "cryptonote_basic/cryptonote_format_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "ringct/rctSigs.h" namespace cryptonote diff --git a/src/rpc/instanciations.cpp b/src/rpc/instanciations.cpp new file mode 100644 index 000000000..ac521247e --- /dev/null +++ b/src/rpc/instanciations.cpp @@ -0,0 +1,37 @@ +// Copyright (c) 2017, 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 + +#include "p2p/net_node.h" +#include "p2p/net_node.inl" +#include "cryptonote_protocol/cryptonote_protocol_handler.h" +#include "cryptonote_protocol/cryptonote_protocol_handler.inl" + +namespace nodetool { template class node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core>>; } +namespace cryptonote { template class t_cryptonote_protocol_handler<cryptonote::core>; } diff --git a/src/rpc/rpc_args.cpp b/src/rpc/rpc_args.cpp index e03c5472d..ce4070270 100644 --- a/src/rpc/rpc_args.cpp +++ b/src/rpc/rpc_args.cpp @@ -30,6 +30,7 @@ #include <boost/algorithm/string.hpp> #include <boost/asio/ip/address.hpp> +#include <boost/bind.hpp> #include "common/command_line.h" #include "common/i18n.h" diff --git a/src/serialization/json_object.h b/src/serialization/json_object.h index 5dca7b249..fc4f528b2 100644 --- a/src/serialization/json_object.h +++ b/src/serialization/json_object.h @@ -28,6 +28,7 @@ #pragma once +#include "string_tools.h" #include "rapidjson/document.h" #include "cryptonote_basic/cryptonote_basic.h" #include "rpc/message_data_structs.h" diff --git a/src/simplewallet/CMakeLists.txt b/src/simplewallet/CMakeLists.txt index 3ff4466fc..beaacf0e9 100644 --- a/src/simplewallet/CMakeLists.txt +++ b/src/simplewallet/CMakeLists.txt @@ -43,7 +43,7 @@ monero_add_executable(simplewallet target_link_libraries(simplewallet PRIVATE wallet - rpc + rpc_base cryptonote_core cncrypto common diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt index 74992139d..ab48bd7a2 100644 --- a/src/wallet/CMakeLists.txt +++ b/src/wallet/CMakeLists.txt @@ -82,7 +82,7 @@ target_link_libraries(wallet_rpc_server PRIVATE wallet epee - rpc + rpc_base cryptonote_core cncrypto common diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index ef8a75375..abd24295a 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -28,12 +28,15 @@ // // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers +#include <numeric> #include <random> #include <tuple> #include <boost/format.hpp> #include <boost/optional/optional.hpp> #include <boost/utility/value_init.hpp> -#include <boost/algorithm/string/join.hpp> +#include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/trim.hpp> +#include <boost/algorithm/string/split.hpp> #include "include_base_utils.h" using namespace epee; @@ -49,7 +52,7 @@ using namespace epee; #include "profile_tools.h" #include "crypto/crypto.h" #include "serialization/binary_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "mnemonics/electrum-words.h" #include "common/i18n.h" #include "common/util.h" diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index de1bed90c..be8315468 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -59,8 +59,6 @@ #include "common/password.h" #include "node_rpc_proxy.h" -#include <iostream> - #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2" diff --git a/src/wallet/wallet_args.cpp b/src/wallet/wallet_args.cpp index e665042d4..91162c4bc 100644 --- a/src/wallet/wallet_args.cpp +++ b/src/wallet/wallet_args.cpp @@ -28,6 +28,7 @@ #include "wallet/wallet_args.h" #include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> #include <boost/format.hpp> #include "common/i18n.h" #include "common/util.h" diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp index fd07a5d2e..d6c89fc39 100644 --- a/tests/core_proxy/core_proxy.cpp +++ b/tests/core_proxy/core_proxy.cpp @@ -42,8 +42,10 @@ #include "common/command_line.h" #include "console_handler.h" #include "p2p/net_node.h" +#include "p2p/net_node.inl" //#include "cryptonote_core/cryptonote_core.h" #include "cryptonote_protocol/cryptonote_protocol_handler.h" +#include "cryptonote_protocol/cryptonote_protocol_handler.inl" #include "core_proxy.h" #include "version.h" diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 7cad04047..0dcbc7f0c 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -467,7 +467,7 @@ inline bool do_replay_events(std::vector<test_event_entry>& events) // FIXME: make sure that vm has arg_testnet_on set to true or false if // this test needs for it to be so. get_test_options<t_test_class> gto; - if (!c.init(vm, >o.test_options)) + if (!c.init(vm, NULL, >o.test_options)) { MERROR("Failed to init core"); return false; diff --git a/tests/functional_tests/main.cpp b/tests/functional_tests/main.cpp index 35a0bb9bd..9fd24cc06 100644 --- a/tests/functional_tests/main.cpp +++ b/tests/functional_tests/main.cpp @@ -31,6 +31,7 @@ #include <boost/program_options.hpp> #include "include_base_utils.h" +#include "string_tools.h" using namespace epee; #include "common/command_line.h" diff --git a/tests/fuzz/block.cpp b/tests/fuzz/block.cpp index 03751fc14..ce8785cc3 100644 --- a/tests/fuzz/block.cpp +++ b/tests/fuzz/block.cpp @@ -28,7 +28,7 @@ #include "include_base_utils.h" #include "file_io_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "fuzzer.h" diff --git a/tests/fuzz/cold-outputs.cpp b/tests/fuzz/cold-outputs.cpp index e585b4b13..2785db05d 100644 --- a/tests/fuzz/cold-outputs.cpp +++ b/tests/fuzz/cold-outputs.cpp @@ -28,7 +28,7 @@ #include "include_base_utils.h" #include "file_io_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "wallet/wallet2.h" diff --git a/tests/fuzz/cold-transaction.cpp b/tests/fuzz/cold-transaction.cpp index 25a80fc68..f0b4b26d6 100644 --- a/tests/fuzz/cold-transaction.cpp +++ b/tests/fuzz/cold-transaction.cpp @@ -28,7 +28,7 @@ #include "include_base_utils.h" #include "file_io_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "wallet/wallet2.h" diff --git a/tests/fuzz/fuzzer.cpp b/tests/fuzz/fuzzer.cpp index 756a8c847..ede3fcc40 100644 --- a/tests/fuzz/fuzzer.cpp +++ b/tests/fuzz/fuzzer.cpp @@ -28,6 +28,7 @@ #include <boost/program_options.hpp> #include "include_base_utils.h" +#include "string_tools.h" #include "common/command_line.h" #include "common/util.h" #include "fuzzer.h" diff --git a/tests/fuzz/signature.cpp b/tests/fuzz/signature.cpp index 42a8fa997..7ec4434e6 100644 --- a/tests/fuzz/signature.cpp +++ b/tests/fuzz/signature.cpp @@ -28,7 +28,7 @@ #include "include_base_utils.h" #include "file_io_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "wallet/wallet2.h" diff --git a/tests/fuzz/transaction.cpp b/tests/fuzz/transaction.cpp index 9e2b9f2cb..294676404 100644 --- a/tests/fuzz/transaction.cpp +++ b/tests/fuzz/transaction.cpp @@ -28,7 +28,7 @@ #include "include_base_utils.h" #include "file_io_utils.h" -#include "cryptonote_protocol/blobdatatype.h" +#include "cryptonote_basic/blobdatatype.h" #include "cryptonote_basic/cryptonote_basic.h" #include "cryptonote_basic/cryptonote_format_utils.h" #include "fuzzer.h" diff --git a/tests/performance_tests/cn_slow_hash.h b/tests/performance_tests/cn_slow_hash.h index 7b04d5bcc..bf9eb7501 100644 --- a/tests/performance_tests/cn_slow_hash.h +++ b/tests/performance_tests/cn_slow_hash.h @@ -30,6 +30,7 @@ #pragma once +#include "string_tools.h" #include "crypto/crypto.h" #include "cryptonote_basic/cryptonote_basic.h" diff --git a/tests/unit_tests/ban.cpp b/tests/unit_tests/ban.cpp index 242e5fe1c..5af514643 100644 --- a/tests/unit_tests/ban.cpp +++ b/tests/unit_tests/ban.cpp @@ -31,7 +31,9 @@ #include "gtest/gtest.h" #include "cryptonote_core/cryptonote_core.h" #include "p2p/net_node.h" +#include "p2p/net_node.inl" #include "cryptonote_protocol/cryptonote_protocol_handler.h" +#include "cryptonote_protocol/cryptonote_protocol_handler.inl" #define MAKE_IPV4_ADDRESS(a,b,c,d) epee::net_utils::ipv4_network_address{MAKE_IP(a,b,c,d),0} @@ -79,6 +81,7 @@ public: cryptonote::difficulty_type get_block_cumulative_difficulty(uint64_t height) const { return 0; } bool fluffy_blocks_enabled() const { return false; } uint64_t prevalidate_block_hashes(uint64_t height, const std::list<crypto::hash> &hashes) { return 0; } + void stop() {} }; typedef nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<test_core>> Server; @@ -184,3 +187,5 @@ TEST(ban, add) ASSERT_TRUE(t >= 4); } +namespace nodetool { template class node_server<cryptonote::t_cryptonote_protocol_handler<test_core>>; } +namespace cryptonote { template class t_cryptonote_protocol_handler<test_core>; } diff --git a/tests/unit_tests/blockchain_db.cpp b/tests/unit_tests/blockchain_db.cpp index 5592106cb..4ccd9c1c8 100644 --- a/tests/unit_tests/blockchain_db.cpp +++ b/tests/unit_tests/blockchain_db.cpp @@ -35,6 +35,7 @@ #include "gtest/gtest.h" +#include "string_tools.h" #include "blockchain_db/blockchain_db.h" #include "blockchain_db/lmdb/db_lmdb.h" #ifdef BERKELEY_DB diff --git a/tests/unit_tests/http.cpp b/tests/unit_tests/http.cpp index 135c0984e..5e427f064 100644 --- a/tests/unit_tests/http.cpp +++ b/tests/unit_tests/http.cpp @@ -30,6 +30,7 @@ #include "net/http_auth.h" #include <boost/algorithm/string/predicate.hpp> +#include <boost/algorithm/string/join.hpp> #include <boost/fusion/adapted/std_pair.hpp> #include <boost/range/algorithm/find_if.hpp> #include <boost/range/iterator_range_core.hpp> diff --git a/tests/unit_tests/main.cpp b/tests/unit_tests/main.cpp index 95ea67410..073ac20fd 100644 --- a/tests/unit_tests/main.cpp +++ b/tests/unit_tests/main.cpp @@ -30,10 +30,16 @@ #include "gtest/gtest.h" -#include <boost/filesystem.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> #include <boost/program_options.hpp> +#include "p2p/net_node.h" +#include "p2p/net_node.inl" +#include "cryptonote_protocol/cryptonote_protocol_handler.h" +#include "cryptonote_protocol/cryptonote_protocol_handler.inl" #include "include_base_utils.h" +#include "string_tools.h" #include "common/command_line.h" #include "common/util.h" #include "unit_tests_utils.h" @@ -42,6 +48,9 @@ namespace po = boost::program_options; boost::filesystem::path unit_test::data_dir; +namespace nodetool { template class node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core>>; } +namespace cryptonote { template class t_cryptonote_protocol_handler<cryptonote::core>; } + int main(int argc, char** argv) { tools::on_startup(); |