1
0
Fork 0
forked from lthn/blockchain

Merge branch 'release'

This commit is contained in:
cryptozoidberg 2019-05-23 05:11:51 +02:00
commit 29c0487bd9
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
78 changed files with 2548 additions and 1441 deletions

59
.clang-format Normal file
View file

@ -0,0 +1,59 @@
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'true'
AlignConsecutiveDeclarations: 'false'
AlignEscapedNewlines: Right
AlignOperands: 'false'
AlignTrailingComments: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'false'
AllowShortCaseLabelsOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: 'true'
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: 'true'
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakAfterJavaFieldAnnotations: 'true'
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Stroustrup
BreakBeforeInheritanceComma: 'false'
BreakBeforeTernaryOperators: 'false'
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: 'false'
ColumnLimit: '0'
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
Cpp11BracedListStyle: 'false'
DerivePointerAlignment: 'false'
DisableFormat: 'false'
ExperimentalAutoDetectBinPacking: 'true'
FixNamespaceComments: 'true'
IndentCaseLabels: 'true'
IndentPPDirectives: AfterHash
IndentWidth: '2'
IndentWrappedFunctionNames: 'true'
JavaScriptQuotes: Leave
KeepEmptyLinesAtTheStartOfBlocks: 'false'
Language: Cpp
NamespaceIndentation: None
PointerAlignment: Left
ReflowComments: 'true'
SortIncludes: 'false'
SortUsingDeclarations: 'false'
SpaceAfterCStyleCast: 'false'
SpaceAfterTemplateKeyword: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: Never
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: '2'
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInContainerLiterals: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '2'
UseTab: Never

View file

@ -15,9 +15,19 @@ set(VERSION "1.0")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
#set(CMAKE_BUILD_TYPE "Debug")
# build types
if (UNIX AND NOT APPLE)
# single configurations, defaults to Release
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
else()
# multi configurations for MSVC and XCode
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
endif()
message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}, and built type: ${CMAKE_BUILD_TYPE}")
enable_testing()

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -313,7 +314,11 @@ namespace misc_utils
{}
~call_befor_die()
{
NESTED_TRY_ENTRY();
m_func();
NESTED_CATCH_ENTRY(__func__);
}
};

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -118,6 +119,187 @@ DISABLE_VS_WARNINGS(4100)
#define LOCATION_SS "[" << LOCAL_FUNCTION_DEF__ << ("] @ " __FILE__ ":" STR(__LINE__))
#if !defined(DISABLE_RELEASE_LOGGING)
#define ENABLE_LOGGING_INTERNAL
#endif
#define LOG_DEFAULT_CHANNEL NULL
#define ENABLE_CHANNEL_BY_DEFAULT(ch_name) \
static bool COMBINE(init_channel, __LINE__) UNUSED_ATTRIBUTE = epee::misc_utils::static_initializer([](){ \
epee::log_space::log_singletone::enable_channel(ch_name); return true; \
});
#if defined(ENABLE_LOGGING_INTERNAL)
#define LOG_PRINT_CHANNEL_NO_PREFIX2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str() , y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL_NO_PREFIX_NO_POSTFIX2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL_NO_POSTFIX2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL_COLOR2(log_channel, log_name, x, y, color) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, color, false, log_name);}}
#define LOG_PRINT_CHANNEL_2_JORNAL(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, true, log_name);}}
#define LOG_ERROR2(log_name, x) { \
std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << "[ERROR] Location: " << std::endl << LOCATION_SS << epee::misc_utils::print_trace() << " Message:" << std::endl << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str(), LOG_LEVEL_0, epee::log_space::console_color_red, true, log_name); LOCAL_ASSERT(0); epee::log_space::increase_error_count(LOG_DEFAULT_CHANNEL); }
#define LOG_FRAME2(log_name, x, y) epee::log_space::log_frame frame(x, y, log_name)
#else // #if defined(ENABLE_LOGGING_INTERNAL)
#define LOG_PRINT_NO_PREFIX2(log_name, x, y)
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y)
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y)
#define LOG_PRINT_COLOR2(log_name, x, y, color)
#define LOG_PRINT2_JORNAL(log_name, x, y)
#define LOG_PRINT2(log_name, x, y)
#define LOG_ERROR2(log_name, x)
#define LOG_FRAME2(log_name, x, y)
#endif // #if defined(ENABLE_LOGGING_INTERNAL)
#define LOG_PRINT_NO_PREFIX2(log_name, x, y) LOG_PRINT_CHANNEL_NO_PREFIX2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y) LOG_PRINT_CHANNEL_NO_PREFIX_NO_POSTFIX2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y) LOG_PRINT_CHANNEL_NO_POSTFIX2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT2(log_name, x, y) LOG_PRINT_CHANNEL2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT_COLOR2(log_name, x, y, color) LOG_PRINT_CHANNEL_COLOR2(LOG_DEFAULT_CHANNEL, log_name, x, y, color)
#define LOG_PRINT2_JORNAL(log_name, x, y) LOG_PRINT_CHANNEL_2_JORNAL(LOG_DEFAULT_CHANNEL, log_name, x, y)
#ifndef LOG_DEFAULT_TARGET
#define LOG_DEFAULT_TARGET NULL
#endif
#define LOG_PRINT_NO_POSTFIX(mess, level) LOG_PRINT_NO_POSTFIX2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT_NO_PREFIX(mess, level) LOG_PRINT_NO_PREFIX2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX(mess, level) LOG_PRINT_NO_PREFIX_NO_POSTFIX2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT(mess, level) LOG_PRINT2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT_COLOR(mess, level, color) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, color)
#define LOG_PRINT_RED(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_red)
#define LOG_PRINT_GREEN(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_green)
#define LOG_PRINT_BLUE(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_blue)
#define LOG_PRINT_YELLOW(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_yellow)
#define LOG_PRINT_CYAN(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_cyan)
#define LOG_PRINT_MAGENTA(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_magenta)
#define LOG_PRINT_RED_L0(mess) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, LOG_LEVEL_0, epee::log_space::console_color_red)
#define LOG_PRINT_L0(mess) LOG_PRINT(mess, LOG_LEVEL_0)
#define LOG_PRINT_L1(mess) LOG_PRINT(mess, LOG_LEVEL_1)
#define LOG_PRINT_L2(mess) LOG_PRINT(mess, LOG_LEVEL_2)
#define LOG_PRINT_L3(mess) LOG_PRINT(mess, LOG_LEVEL_3)
#define LOG_PRINT_L4(mess) LOG_PRINT(mess, LOG_LEVEL_4)
#define LOG_PRINT_J(mess, level) LOG_PRINT2_JORNAL(LOG_DEFAULT_TARGET, mess, level)
#define LOG_ERROR(mess) LOG_ERROR2(LOG_DEFAULT_TARGET, mess)
#define LOG_FRAME(mess, level) LOG_FRAME2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_VALUE(mess, level) LOG_VALUE2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_ARRAY(mess, level) LOG_ARRAY2(LOG_DEFAULT_TARGET, mess, level)
//#define LOGWIN_PLATFORM_ERROR(err_no) LOGWINDWOS_PLATFORM_ERROR2(LOG_DEFAULT_TARGET, err_no)
#define LOG_SOCKET_ERROR(err_no) LOG_SOCKET_ERROR2(LOG_DEFAULT_TARGET, err_no)
//#define LOGWIN_PLATFORM_ERROR_UNCRITICAL(mess) LOGWINDWOS_PLATFORM_ERROR_UNCRITICAL2(LOG_DEFAULT_TARGET, mess)
#define ENDL std::endl
#define TRY_ENTRY() try {
#define CATCH_ENTRY_CUSTOM(location, custom_code, return_val) } \
catch(const std::exception& ex) \
{ \
(void)(ex); \
LOG_ERROR("Exception at [" << location << "], what=" << ex.what()); \
custom_code; \
return return_val; \
} \
catch(...) \
{ \
LOG_ERROR("Exception at [" << location << "], generic exception \"...\""); \
custom_code; \
return return_val; \
}
#define CATCH_ENTRY(location, return_val) CATCH_ENTRY_CUSTOM(location, (void)0, return_val)
#define CATCH_ENTRY2(return_val) CATCH_ENTRY_CUSTOM(LOCATION_SS, (void)0, return_val)
#define CATCH_ENTRY_L0(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L1(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L2(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L3(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L4(location, return_val) CATCH_ENTRY(location, return_val)
/// @brief Catches TRY_ENTRY without returning
/// @details Useful within a dtor - but only if nested within another try block
/// (since we can still potentially throw here). See NESTED_*ENTRY()
/// @todo Exception dispatcher class
#define CATCH_ENTRY_NO_RETURN(location, custom_code) } \
catch(const std::exception& ex) \
{ \
(void)(ex); \
LOG_ERROR("Exception at [" << location << "], what=" << ex.what()); \
custom_code; \
} \
catch(...) \
{ \
LOG_ERROR("Exception at [" << location << "], generic exception \"...\""); \
custom_code; \
}
#define NESTED_TRY_ENTRY() try { TRY_ENTRY();
#define NESTED_CATCH_ENTRY(location) \
CATCH_ENTRY_NO_RETURN(location, {}); \
} catch (...) {}
#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw std::runtime_error(ss.str());}
#define CHECK_AND_ASSERT_THROW_MES(expr, message) {if(!(expr)) ASSERT_MES_AND_THROW(message << ENDL << "thrown from " << LOCATION_SS);}
#define CHECK_AND_ASSERT_THROW(expr, exception_exp) {if(!(expr)) {LOG_ERROR("EXCEPTION is thrown from " << LOCATION_SS); throw exception_exp; };}
#ifndef CHECK_AND_ASSERT
#define CHECK_AND_ASSERT(expr, fail_ret_val) do{if(!(expr)){LOCAL_ASSERT(expr); return fail_ret_val;};}while(0)
#endif
#define NOTHING
#ifndef CHECK_AND_ASSERT_MES
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_FORCE_ASSERT_MES
#define CHECK_AND_FORCE_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); FORCE_ASSERT(expr); return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_ASSERT_MES_CUSTOM
#define CHECK_AND_ASSERT_MES_CUSTOM(expr, fail_ret_val, custom_code, message) do{if(!(expr)) {LOG_ERROR(message); custom_code; return fail_ret_val;};}while(0)
#endif
/*#ifndef CHECK_AND_ASSERT_MES_AND_THROW
#define CHECK_AND_ASSERT_MES_AND_THROW(expr, message) do{if(!(expr)) {LOG_ERROR(message); throw std::runtime_error(message);};}while(0)
#endif
*/
#ifndef CHECK_AND_NO_ASSERT_MES
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_PRINT_MAGENTA(message, LOG_LEVEL_0); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_NO_ASSERT_MES_LEVEL
#define CHECK_AND_NO_ASSERT_MES_LEVEL(expr, fail_ret_val, message, log_level) do{if(!(expr)) {LOG_PRINT(message, log_level); return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_ASSERT_MES_NO_RET
#define CHECK_AND_ASSERT_MES_NO_RET(expr, message) do{if(!(expr)) {LOG_ERROR(message);};}while(0)
#endif
#ifndef CHECK_AND_ASSERT_MES2
#define CHECK_AND_ASSERT_MES2(expr, message) do{if(!(expr)) {LOG_ERROR(message); };}while(0)
#endif
namespace epee
{
@ -703,7 +885,7 @@ namespace log_space
m_log_streams.push_back(streams_container::value_type(ls, log_level_limit));
return true;
}
return ls ? true:false;
return false;
}
bool add_logger( ibase_log_stream* pstream, int log_level_limit = LOG_LEVEL_4 )
{
@ -1427,10 +1609,10 @@ POP_WARNINGS
}
~log_frame()
{
NESTED_TRY_ENTRY();
#ifdef _MSC_VER
int lasterr=::GetLastError();
#endif
if (m_level <= log_singletone::get_log_detalisation_level() )
{
std::stringstream ss;
@ -1440,6 +1622,7 @@ POP_WARNINGS
#ifdef _MSC_VER
::SetLastError(lasterr);
#endif
NESTED_CATCH_ENTRY(__func__);
}
};
@ -1500,192 +1683,7 @@ POP_WARNINGS
}
}
#if !defined(DISABLE_RELEASE_LOGGING)
#define ENABLE_LOGGING_INTERNAL
#endif
#define LOG_DEFAULT_CHANNEL NULL
#define ENABLE_CHANNEL_BY_DEFAULT(ch_name) \
static bool COMBINE(init_channel, __LINE__) UNUSED_ATTRIBUTE = epee::misc_utils::static_initializer([](){ \
epee::log_space::log_singletone::enable_channel(ch_name); return true; \
});
#if defined(ENABLE_LOGGING_INTERNAL)
#define LOG_PRINT_CHANNEL_NO_PREFIX2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str() , y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL_NO_PREFIX_NO_POSTFIX2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL_NO_POSTFIX2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x; epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL2(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, false, log_name);}}
#define LOG_PRINT_CHANNEL_COLOR2(log_channel, log_name, x, y, color) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, color, false, log_name);}}
#define LOG_PRINT_CHANNEL_2_JORNAL(log_channel, log_name, x, y) {if ( y <= epee::log_space::log_singletone::get_log_detalisation_level() && epee::log_space::log_singletone::channel_enabled(log_channel))\
{std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << x << std::endl;epee::log_space::log_singletone::do_log_message(ss________.str(), y, epee::log_space::console_color_default, true, log_name);}}
#define LOG_ERROR2(log_name, x) { \
std::stringstream ss________; ss________ << epee::log_space::log_singletone::get_prefix_entry() << "[ERROR] Location: " << std::endl << LOCATION_SS << epee::misc_utils::print_trace() << " Message:" << std::endl << x << std::endl; epee::log_space::log_singletone::do_log_message(ss________.str(), LOG_LEVEL_0, epee::log_space::console_color_red, true, log_name); LOCAL_ASSERT(0); epee::log_space::increase_error_count(LOG_DEFAULT_CHANNEL); }
#define LOG_FRAME2(log_name, x, y) epee::log_space::log_frame frame(x, y, log_name)
#else // #if defined(ENABLE_LOGGING_INTERNAL)
#define LOG_PRINT_NO_PREFIX2(log_name, x, y)
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y)
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y)
#define LOG_PRINT_COLOR2(log_name, x, y, color)
#define LOG_PRINT2_JORNAL(log_name, x, y)
#define LOG_PRINT2(log_name, x, y)
#define LOG_ERROR2(log_name, x)
#define LOG_FRAME2(log_name, x, y)
#endif // #if defined(ENABLE_LOGGING_INTERNAL)
#define LOG_PRINT_NO_PREFIX2(log_name, x, y) LOG_PRINT_CHANNEL_NO_PREFIX2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX2(log_name, x, y) LOG_PRINT_CHANNEL_NO_PREFIX_NO_POSTFIX2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT_NO_POSTFIX2(log_name, x, y) LOG_PRINT_CHANNEL_NO_POSTFIX2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT2(log_name, x, y) LOG_PRINT_CHANNEL2(LOG_DEFAULT_CHANNEL, log_name, x, y)
#define LOG_PRINT_COLOR2(log_name, x, y, color) LOG_PRINT_CHANNEL_COLOR2(LOG_DEFAULT_CHANNEL, log_name, x, y, color)
#define LOG_PRINT2_JORNAL(log_name, x, y) LOG_PRINT_CHANNEL_2_JORNAL(LOG_DEFAULT_CHANNEL, log_name, x, y)
#ifndef LOG_DEFAULT_TARGET
#define LOG_DEFAULT_TARGET NULL
#endif
#define LOG_PRINT_NO_POSTFIX(mess, level) LOG_PRINT_NO_POSTFIX2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT_NO_PREFIX(mess, level) LOG_PRINT_NO_PREFIX2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT_NO_PREFIX_NO_POSTFIX(mess, level) LOG_PRINT_NO_PREFIX_NO_POSTFIX2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT(mess, level) LOG_PRINT2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_PRINT_COLOR(mess, level, color) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, color)
#define LOG_PRINT_RED(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_red)
#define LOG_PRINT_GREEN(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_green)
#define LOG_PRINT_BLUE(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_blue)
#define LOG_PRINT_YELLOW(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_yellow)
#define LOG_PRINT_CYAN(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_cyan)
#define LOG_PRINT_MAGENTA(mess, level) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, level, epee::log_space::console_color_magenta)
#define LOG_PRINT_RED_L0(mess) LOG_PRINT_COLOR2(LOG_DEFAULT_TARGET, mess, LOG_LEVEL_0, epee::log_space::console_color_red)
#define LOG_PRINT_L0(mess) LOG_PRINT(mess, LOG_LEVEL_0)
#define LOG_PRINT_L1(mess) LOG_PRINT(mess, LOG_LEVEL_1)
#define LOG_PRINT_L2(mess) LOG_PRINT(mess, LOG_LEVEL_2)
#define LOG_PRINT_L3(mess) LOG_PRINT(mess, LOG_LEVEL_3)
#define LOG_PRINT_L4(mess) LOG_PRINT(mess, LOG_LEVEL_4)
#define LOG_PRINT_J(mess, level) LOG_PRINT2_JORNAL(LOG_DEFAULT_TARGET, mess, level)
#define LOG_ERROR(mess) LOG_ERROR2(LOG_DEFAULT_TARGET, mess)
#define LOG_FRAME(mess, level) LOG_FRAME2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_VALUE(mess, level) LOG_VALUE2(LOG_DEFAULT_TARGET, mess, level)
#define LOG_ARRAY(mess, level) LOG_ARRAY2(LOG_DEFAULT_TARGET, mess, level)
//#define LOGWIN_PLATFORM_ERROR(err_no) LOGWINDWOS_PLATFORM_ERROR2(LOG_DEFAULT_TARGET, err_no)
#define LOG_SOCKET_ERROR(err_no) LOG_SOCKET_ERROR2(LOG_DEFAULT_TARGET, err_no)
//#define LOGWIN_PLATFORM_ERROR_UNCRITICAL(mess) LOGWINDWOS_PLATFORM_ERROR_UNCRITICAL2(LOG_DEFAULT_TARGET, mess)
#define ENDL std::endl
#define TRY_ENTRY() try {
#define CATCH_ENTRY_CUSTOM(location, custom_code, return_val) } \
catch(const std::exception& ex) \
{ \
(void)(ex); \
LOG_ERROR("Exception at [" << location << "], what=" << ex.what()); \
custom_code; \
return return_val; \
} \
catch(...) \
{ \
LOG_ERROR("Exception at [" << location << "], generic exception \"...\""); \
custom_code; \
return return_val; \
}
#define CATCH_ENTRY(location, return_val) CATCH_ENTRY_CUSTOM(location, (void)0, return_val)
#define CATCH_ENTRY2(return_val) CATCH_ENTRY_CUSTOM(LOCATION_SS, (void)0, return_val)
#define CATCH_ENTRY_L0(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L1(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L2(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L3(location, return_val) CATCH_ENTRY(location, return_val)
#define CATCH_ENTRY_L4(location, return_val) CATCH_ENTRY(location, return_val)
#define ASSERT_MES_AND_THROW(message) {LOG_ERROR(message); std::stringstream ss; ss << message; throw std::runtime_error(ss.str());}
#define CHECK_AND_ASSERT_THROW_MES(expr, message) {if(!(expr)) ASSERT_MES_AND_THROW(message << ENDL << "thrown from " << LOCATION_SS);}
#define CHECK_AND_ASSERT_THROW(expr, exception_exp) {if(!(expr)) {LOG_ERROR("EXCEPTION is thrown from " << LOCATION_SS); throw exception_exp; };}
#ifndef CHECK_AND_ASSERT
#define CHECK_AND_ASSERT(expr, fail_ret_val) do{if(!(expr)){LOCAL_ASSERT(expr); return fail_ret_val;};}while(0)
#endif
#define NOTHING
#ifndef CHECK_AND_ASSERT_MES
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_FORCE_ASSERT_MES
#define CHECK_AND_FORCE_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); FORCE_ASSERT(expr); return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_ASSERT_MES_CUSTOM
#define CHECK_AND_ASSERT_MES_CUSTOM(expr, fail_ret_val, custom_code, message) do{if(!(expr)) {LOG_ERROR(message); custom_code; return fail_ret_val;};}while(0)
#endif
/*#ifndef CHECK_AND_ASSERT_MES_AND_THROW
#define CHECK_AND_ASSERT_MES_AND_THROW(expr, message) do{if(!(expr)) {LOG_ERROR(message); throw std::runtime_error(message);};}while(0)
#endif
*/
#ifndef CHECK_AND_NO_ASSERT_MES
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_PRINT_MAGENTA(message, LOG_LEVEL_0); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_NO_ASSERT_MES_LEVEL
#define CHECK_AND_NO_ASSERT_MES_LEVEL(expr, fail_ret_val, message, log_level) do{if(!(expr)) {LOG_PRINT(message, log_level); return fail_ret_val;};}while(0)
#endif
#ifndef CHECK_AND_ASSERT_MES_NO_RET
#define CHECK_AND_ASSERT_MES_NO_RET(expr, message) do{if(!(expr)) {LOG_ERROR(message);};}while(0)
#endif
#ifndef CHECK_AND_ASSERT_MES2
#define CHECK_AND_ASSERT_MES2(expr, message) do{if(!(expr)) {LOG_ERROR(message); };}while(0)
#endif
}
} // namespace epee
POP_WARNINGS

View file

@ -1,6 +1,7 @@
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
@ -11,7 +12,7 @@
// * Neither the name of the Andrey N. Sabelnikov 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
@ -22,13 +23,10 @@
// 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.
//
#ifndef _ABSTRACT_TCP_SERVER2_H_
#define _ABSTRACT_TCP_SERVER2_H_
//
#ifndef _ABSTRACT_TCP_SERVER2_H_
#define _ABSTRACT_TCP_SERVER2_H_
#include <boost/asio.hpp>
#include <string>
@ -47,247 +45,271 @@
#include "net_utils_base.h"
#include "syncobj.h"
#undef LOG_DEFAULT_CHANNEL
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL "net_server"
#define ABSTRACT_SERVER_SEND_QUE_MAX_COUNT 1000
namespace epee
{
namespace net_utils
{
namespace epee {
namespace net_utils {
struct i_connection_filter {
virtual bool is_remote_ip_allowed(uint32_t adress) = 0;
struct i_connection_filter
{
virtual bool is_remote_ip_allowed(uint32_t adress)=0;
protected:
virtual ~i_connection_filter(){}
};
/************************************************************************/
/* */
/************************************************************************/
/// Represents a single connection from a client.
template<class t_protocol_handler>
class connection
: public boost::enable_shared_from_this<connection<t_protocol_handler> >,
private boost::noncopyable,
public i_service_endpoint
virtual ~i_connection_filter()
{
}
};
/************************************************************************/
/* */
/************************************************************************/
/// Represents a single connection from a client.
template<class t_protocol_handler>
class connection
: public boost::enable_shared_from_this<connection<t_protocol_handler>>,
private boost::noncopyable,
public i_service_endpoint {
public:
typedef typename t_protocol_handler::connection_context t_connection_context;
/// Construct a connection with the given io_service.
explicit connection(boost::asio::io_service& io_service,
typename t_protocol_handler::config_type& config, volatile uint32_t& sock_count, i_connection_filter * &pfilter);
typedef typename t_protocol_handler::connection_context t_connection_context;
/// Construct a connection with the given io_service.
explicit connection(boost::asio::io_service& io_service,
typename t_protocol_handler::config_type& config, volatile uint32_t& sock_count, i_connection_filter*& pfilter);
virtual ~connection();
/// Get the socket associated with the connection.
boost::asio::ip::tcp::socket& socket();
virtual ~connection();
/// Get the socket associated with the connection.
boost::asio::ip::tcp::socket& socket();
/// Start the first asynchronous operation for the connection.
bool start(bool is_income, bool is_multithreaded);
/// Start the first asynchronous operation for the connection.
bool start(bool is_income, bool is_multithreaded);
void get_context(t_connection_context& context_){context_ = context;}
void get_context(t_connection_context& context_)
{
context_ = context;
}
void call_back_starter();
bool is_shutdown()
{
return m_was_shutdown;
}
bool cancel();
void call_back_starter();
bool is_shutdown(){return m_was_shutdown;}
bool cancel();
private:
//----------------- i_service_endpoint ---------------------
virtual bool do_send(const void* ptr, size_t cb);
virtual bool close();
virtual bool call_run_once_service_io();
virtual bool request_callback();
virtual boost::asio::io_service& get_io_service();
virtual bool add_ref();
virtual bool release();
//------------------------------------------------------
boost::shared_ptr<connection<t_protocol_handler> > safe_shared_from_this();
bool shutdown();
/// Handle completion of a read operation.
void handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred);
//----------------- i_service_endpoint ---------------------
virtual bool do_send(const void* ptr, size_t cb);
virtual bool close();
virtual bool call_run_once_service_io();
virtual bool request_callback();
virtual boost::asio::io_service& get_io_service();
virtual bool add_ref();
virtual bool release();
//------------------------------------------------------
boost::shared_ptr<connection<t_protocol_handler>> safe_shared_from_this();
bool shutdown();
/// Handle completion of a read operation.
void handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred);
/// Handle completion of a write operation.
void handle_write(const boost::system::error_code& e, size_t cb);
/// Handle completion of a write operation.
void handle_write(const boost::system::error_code& e, size_t cb);
/// Strand to ensure the connection's handlers are not called concurrently.
boost::asio::io_service::strand strand_;
/// Strand to ensure the connection's handlers are not called concurrently.
boost::asio::io_service::strand strand_;
/// Socket for the connection.
boost::asio::ip::tcp::socket socket_;
/// Socket for the connection.
boost::asio::ip::tcp::socket socket_;
/// Buffer for incoming data.
boost::array<char, 8192> buffer_;
/// Buffer for incoming data.
boost::array<char, 8192> buffer_;
t_connection_context context;
volatile uint32_t m_want_close_connection;
std::atomic<bool> m_was_shutdown;
critical_section m_send_que_lock;
std::list<std::string> m_send_que;
volatile uint32_t& m_ref_sockets_count;
i_connection_filter* &m_pfilter;
volatile bool m_is_multithreaded;
boost::asio::io_service& m_rio_service;
t_connection_context context;
volatile uint32_t m_want_close_connection;
std::atomic<bool> m_was_shutdown;
critical_section m_send_que_lock;
std::list<std::string> m_send_que;
volatile uint32_t& m_ref_sockets_count;
i_connection_filter*& m_pfilter;
volatile bool m_is_multithreaded;
//this should be the last one, because it could be wait on destructor, while other activities possible on other threads
t_protocol_handler m_protocol_handler;
//typename t_protocol_handler::config_type m_dummy_config;
std::list<boost::shared_ptr<connection<t_protocol_handler> > > m_self_refs; // add_ref/release support
critical_section m_self_refs_lock;
};
//this should be the last one, because it could be wait on destructor, while other activities possible on other threads
t_protocol_handler m_protocol_handler;
//typename t_protocol_handler::config_type m_dummy_config;
std::list<boost::shared_ptr<connection<t_protocol_handler>>> m_self_refs; // add_ref/release support
critical_section m_self_refs_lock;
};
/************************************************************************/
/* */
/************************************************************************/
template<class t_protocol_handler>
class boosted_tcp_server
: private boost::noncopyable
{
/************************************************************************/
/* */
/************************************************************************/
template<class t_protocol_handler>
class boosted_tcp_server
: private boost::noncopyable {
public:
typedef boost::shared_ptr<connection<t_protocol_handler> > connection_ptr;
typedef typename t_protocol_handler::connection_context t_connection_context;
/// Construct the server to listen on the specified TCP address and port, and
/// serve up files from the given directory.
boosted_tcp_server();
explicit boosted_tcp_server(boost::asio::io_service& external_io_service);
~boosted_tcp_server();
typedef boost::shared_ptr<connection<t_protocol_handler>> connection_ptr;
typedef typename t_protocol_handler::connection_context t_connection_context;
/// Construct the server to listen on the specified TCP address and port, and
/// serve up files from the given directory.
boosted_tcp_server();
explicit boosted_tcp_server(boost::asio::io_service& external_io_service);
~boosted_tcp_server();
bool init_server(uint32_t port, const std::string address = "0.0.0.0");
bool init_server(const std::string port, const std::string& address = "0.0.0.0");
bool init_server(uint32_t port, const std::string address = "0.0.0.0");
bool init_server(const std::string port, const std::string& address = "0.0.0.0");
/// Run the server's io_service loop.
bool run_server(size_t threads_count, bool wait = true);
/// Run the server's io_service loop.
bool run_server(size_t threads_count, bool wait = true);
/// wait for service workers stop
bool timed_wait_server_stop(uint64_t wait_mseconds);
/// wait for service workers stop
bool timed_wait_server_stop(uint64_t wait_mseconds);
/// Stop the server.
void send_stop_signal();
/// Stop the server.
void send_stop_signal();
bool is_stop_signal_sent();
bool is_stop_signal_sent();
void set_threads_prefix(const std::string& prefix_name);
void set_threads_prefix(const std::string& prefix_name);
bool deinit_server(){return true;}
bool deinit_server()
{
return true;
}
size_t get_threads_count(){return m_threads_count;}
size_t get_threads_count()
{
return m_threads_count;
}
void set_connection_filter(i_connection_filter* pfilter);
void set_connection_filter(i_connection_filter* pfilter);
bool connect(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_connection_context& cn, const std::string& bind_ip = "0.0.0.0");
template<class t_callback>
bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_callback cb, const std::string& bind_ip = "0.0.0.0");
bool connect(const std::string& adr, const std::string& port, uint32_t conn_timeot, t_connection_context& cn, const std::string& bind_ip = "0.0.0.0");
template<class t_callback>
bool connect_async(const std::string& adr, const std::string& port, uint32_t conn_timeot, const t_callback& cb, const std::string& bind_ip = "0.0.0.0");
typename t_protocol_handler::config_type& get_config_object(){return m_config;}
typename t_protocol_handler::config_type& get_config_object()
{
return m_config;
}
int get_binded_port(){return m_port;}
int get_binded_port()
{
return m_port;
}
boost::asio::io_service& get_io_service(){return io_service_;}
boost::asio::io_service& get_io_service()
{
return io_service_;
}
struct idle_callback_conext_base
struct idle_callback_conext_base {
virtual ~idle_callback_conext_base()
{
virtual ~idle_callback_conext_base(){}
}
virtual bool call_handler(){return true;}
idle_callback_conext_base(boost::asio::io_service& io_serice):
m_timer(io_serice)
{}
boost::asio::deadline_timer m_timer;
uint64_t m_period;
};
template <class t_handler>
struct idle_callback_conext: public idle_callback_conext_base
virtual bool call_handler()
{
idle_callback_conext(boost::asio::io_service& io_serice, t_handler& h, uint64_t period):
idle_callback_conext_base(io_serice),
m_handler(h)
{this->m_period = period;}
t_handler m_handler;
virtual bool call_handler()
{
return m_handler();
}
};
template<class t_handler>
bool add_idle_handler(t_handler t_callback, uint64_t timeout_ms)
{
boost::shared_ptr<idle_callback_conext_base> ptr(new idle_callback_conext<t_handler>(io_service_, t_callback, timeout_ms));
//needed call handler here ?...
ptr->m_timer.expires_from_now(boost::posix_time::milliseconds(ptr->m_period));
ptr->m_timer.async_wait(boost::bind(&boosted_tcp_server<t_protocol_handler>::global_timer_handler, this, ptr));
return true;
}
bool global_timer_handler(/*const boost::system::error_code& err, */boost::shared_ptr<idle_callback_conext_base> ptr)
{
//if handler return false - he don't want to be called anymore
try{
if (!ptr->call_handler())
return true;
}
catch (...)
{
return true;
}
ptr->m_timer.expires_from_now(boost::posix_time::milliseconds(ptr->m_period));
ptr->m_timer.async_wait(boost::bind(&boosted_tcp_server<t_protocol_handler>::global_timer_handler, this, ptr));
return true;
}
template<class t_handler>
bool async_call(t_handler t_callback)
idle_callback_conext_base(boost::asio::io_service& io_serice)
: m_timer(io_serice)
{
io_service_.post(t_callback);
}
boost::asio::deadline_timer m_timer;
uint64_t m_period;
};
template<class t_handler>
struct idle_callback_conext : public idle_callback_conext_base {
idle_callback_conext(boost::asio::io_service& io_serice, t_handler& h, uint64_t period)
: idle_callback_conext_base(io_serice),
m_handler(h)
{
this->m_period = period;
}
t_handler m_handler;
virtual bool call_handler()
{
return m_handler();
}
};
template<class t_handler>
bool add_idle_handler(t_handler t_callback, uint64_t timeout_ms)
{
boost::shared_ptr<idle_callback_conext_base> ptr(new idle_callback_conext<t_handler>(io_service_, t_callback, timeout_ms));
//needed call handler here ?...
ptr->m_timer.expires_from_now(boost::posix_time::milliseconds(ptr->m_period));
ptr->m_timer.async_wait(boost::bind(&boosted_tcp_server<t_protocol_handler>::global_timer_handler, this, ptr));
return true;
}
bool global_timer_handler(/*const boost::system::error_code& err, */ boost::shared_ptr<idle_callback_conext_base> ptr)
{
//if handler return false - he don't want to be called anymore
try {
if(!ptr->call_handler())
return true;
}
catch(...) {
return true;
}
ptr->m_timer.expires_from_now(boost::posix_time::milliseconds(ptr->m_period));
ptr->m_timer.async_wait(boost::bind(&boosted_tcp_server<t_protocol_handler>::global_timer_handler, this, ptr));
return true;
}
template<class t_handler>
bool async_call(t_handler t_callback)
{
io_service_.post(t_callback);
return true;
}
protected:
typename t_protocol_handler::config_type m_config;
typename t_protocol_handler::config_type m_config;
private:
/// Run the server's io_service loop.
bool worker_thread();
/// Handle completion of an asynchronous accept operation.
void handle_accept(const boost::system::error_code& e);
/// Run the server's io_service loop.
bool worker_thread();
/// Handle completion of an asynchronous accept operation.
void handle_accept(const boost::system::error_code& e);
bool is_thread_worker();
bool is_thread_worker();
/// The io_service used to perform asynchronous operations.
std::unique_ptr<boost::asio::io_service> m_io_service_local_instance;
boost::asio::io_service& io_service_;
/// The io_service used to perform asynchronous operations.
std::unique_ptr<boost::asio::io_service> m_io_service_local_instance;
boost::asio::io_service& io_service_;
/// Acceptor used to listen for incoming connections.
boost::asio::ip::tcp::acceptor acceptor_;
/// Acceptor used to listen for incoming connections.
boost::asio::ip::tcp::acceptor acceptor_;
/// The next connection to be accepted.
connection_ptr new_connection_;
//std::mutex connections_mutex;
//std::deque<connection_ptr> connections_;
std::atomic<bool> m_stop_signal_sent;
uint32_t m_port;
volatile uint32_t m_sockets_count;
std::string m_address;
std::string m_thread_name_prefix;
size_t m_threads_count;
i_connection_filter* m_pfilter;
std::vector<boost::shared_ptr<boost::thread> > m_threads;
boost::thread::id m_main_thread_id;
critical_section m_threads_lock;
volatile uint32_t m_thread_index;
};
}
}
/// The next connection to be accepted.
connection_ptr new_connection_;
//std::mutex connections_mutex;
//std::deque<connection_ptr> connections_;
std::atomic<bool> m_stop_signal_sent;
uint32_t m_port;
volatile uint32_t m_sockets_count;
std::string m_address;
std::string m_thread_name_prefix;
size_t m_threads_count;
i_connection_filter* m_pfilter;
std::vector<boost::shared_ptr<boost::thread>> m_threads;
boost::thread::id m_main_thread_id;
critical_section m_threads_lock;
volatile uint32_t m_thread_index;
};
} // namespace net_utils
} // namespace epee
#include "abstract_tcp_server2.inl"
#undef LOG_DEFAULT_CHANNEL
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL NULL
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -137,7 +138,8 @@ namespace net_utils
http_request_info():m_http_method(http_method_unknown),
m_http_ver_hi(0),
m_http_ver_lo(0),
m_have_to_block(false)
m_have_to_block(false),
m_full_request_buf_size(0)
{}
http_method m_http_method;
@ -181,4 +183,4 @@ namespace net_utils
};
}
}
}
}

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -76,7 +77,7 @@ public:
void on_send_stop_signal();
int invoke(int command, const std::string& in_buff, std::string& buff_out, boost::uuids::uuid connection_id);
template<class callback_t>
int invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, callback_t cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
int invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, const callback_t& cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED);
int notify(int command, const std::string& in_buff, boost::uuids::uuid connection_id);
bool close(boost::uuids::uuid connection_id);
@ -86,14 +87,17 @@ public:
bool foreach_connection(callback_t cb);
size_t get_connections_count();
async_protocol_handler_config() :m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false)
async_protocol_handler_config() :m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{}
{}
~async_protocol_handler_config()
{
NESTED_TRY_ENTRY();
CRITICAL_REGION_LOCAL(m_connects_lock);
m_connects.clear();
NESTED_CATCH_ENTRY(__func__);
}
};
@ -213,7 +217,7 @@ public:
std::list<boost::shared_ptr<invoke_response_handler_base> > m_invoke_response_handlers;
template<class callback_t>
bool add_invoke_response_handler(callback_t cb, uint64_t timeout, async_protocol_handler& con, int command)
bool add_invoke_response_handler(const callback_t& cb, uint64_t timeout, async_protocol_handler& con, int command)
{
CRITICAL_REGION_LOCAL(m_invoke_response_handlers_lock);
boost::shared_ptr<invoke_response_handler_base> handler(boost::make_shared<invoke_handler<callback_t>>(cb, timeout, con, command));
@ -226,6 +230,8 @@ public:
async_protocol_handler(net_utils::i_service_endpoint* psnd_hndlr,
config_type& config,
t_connection_context& conn_context):
m_invoke_buf_ready{},
m_invoke_result_code{},
m_current_head(bucket_head2()),
m_pservice_endpoint(psnd_hndlr),
m_config(config),
@ -243,6 +249,8 @@ public:
virtual ~async_protocol_handler()
{
NESTED_TRY_ENTRY();
m_deletion_initiated = true;
if(m_connection_initialized)
{
@ -261,6 +269,8 @@ public:
VALIDATE_MUTEX_IS_FREE(m_send_lock);
VALIDATE_MUTEX_IS_FREE(m_call_lock);
VALIDATE_MUTEX_IS_FREE(m_invoke_response_handlers_lock);
NESTED_CATCH_ENTRY(__func__);
}
bool start_outer_call()
@ -529,7 +539,7 @@ public:
}
template<class callback_t>
bool async_invoke(int command, const std::string& in_buff, callback_t cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
bool async_invoke(int command, const std::string& in_buff, const callback_t& cb, size_t timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
{
misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler(
boost::bind(&async_protocol_handler::finish_outer_call, this));
@ -784,7 +794,7 @@ int async_protocol_handler_config<t_connection_context>::invoke(int command, con
}
//------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t>
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, callback_t cb, size_t timeout)
int async_protocol_handler_config<t_connection_context>::invoke_async(int command, const std::string& in_buff, boost::uuids::uuid connection_id, const callback_t& cb, size_t timeout)
{
async_protocol_handler<t_connection_context>* aph;
int r = find_and_lock_connection(connection_id, aph);

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -85,7 +86,9 @@ namespace net_utils
m_initialized(false),
m_connected(false),
m_deadline(m_io_service),
m_shutdowned(0)
m_shutdowned(0),
m_connect_timeout{},
m_reciev_timeout{}
{
@ -104,8 +107,12 @@ namespace net_utils
inline
~blocked_mode_client()
{
NESTED_TRY_ENTRY();
//profile_tools::local_coast lc("~blocked_mode_client()", 3);
shutdown();
NESTED_CATCH_ENTRY(__func__);
}
inline void set_recv_timeout(int reciev_timeout)

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -106,10 +107,14 @@ namespace profile_tools
}
~local_call_account()
{
NESTED_TRY_ENTRY();
LOG_PRINT2("profile_details.log", "PROFILE "<< std::left << std::setw(50) << (m_name + ":")
<< "av_time:" << std::setw(15) << epee::string_tools::print_fixed_decimal_point (m_count_of_call ? (m_summary_time_used / m_count_of_call) : 0, 3)
<< "sum_time: " << std::setw(15) << epee::string_tools::print_fixed_decimal_point(m_summary_time_used, 3)
<< "call_count: " << std::setw(15) << m_count_of_call, LOG_LEVEL_0);
NESTED_CATCH_ENTRY(__func__);
}
size_t m_count_of_call;
@ -124,17 +129,21 @@ namespace profile_tools
{
m_call_time = boost::posix_time::microsec_clock::local_time();
}
~call_frame()
{
boost::posix_time::ptime now_t(boost::posix_time::microsec_clock::local_time());
boost::posix_time::time_duration delta_microsec = now_t - m_call_time;
uint64_t microseconds_used = delta_microsec.total_microseconds();
m_cc.m_summary_time_used += microseconds_used;
m_cc.m_count_of_call++;
}
private:
~call_frame()
{
NESTED_TRY_ENTRY();
boost::posix_time::ptime now_t(boost::posix_time::microsec_clock::local_time());
boost::posix_time::time_duration delta_microsec = now_t - m_call_time;
uint64_t microseconds_used = delta_microsec.total_microseconds();
m_cc.m_summary_time_used += microseconds_used;
m_cc.m_count_of_call++;
NESTED_CATCH_ENTRY(__func__);
}
private:
local_call_account& m_cc;
boost::posix_time::ptime m_call_time;
};

View file

@ -1,3 +1,4 @@
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
@ -114,7 +115,7 @@ namespace epee
}
template<class t_result, class t_arg, class callback_t, class t_transport>
bool async_invoke_remote_command2(boost::uuids::uuid conn_id, int command, const t_arg& out_struct, t_transport& transport, callback_t cb, size_t inv_timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
bool async_invoke_remote_command2(boost::uuids::uuid conn_id, int command, const t_arg& out_struct, t_transport& transport, const callback_t& cb, size_t inv_timeout = LEVIN_DEFAULT_TIMEOUT_PRECONFIGURED)
{
typename serialization::portable_storage stg;
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation

View file

@ -80,6 +80,7 @@ namespace epee
struct array_entry_t
{
array_entry_t():m_it(m_array.end()){}
array_entry_t(const array_entry_t& other):m_array(other.m_array), m_it(m_array.end()){}
const t_entry_type* get_first_val() const
{

View file

@ -1,4 +1,5 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@ -604,8 +605,14 @@ namespace epee
~guarded_critical_region_t()
{
// TODO(unassigned): because one cannot forward-declare macros,
// the circular dependency created by misc_log_ex will not
// allow us to actually use these substitutions.
//NESTED_TRY_ENTRY();
unlock();
//NESTED_CATCH_ENTRY(__func__);
}
void unlock()

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -25,4 +25,5 @@ namespace command_line
const arg_descriptor<bool> arg_show_details = { "currency-details", "Display currency details" };
const arg_descriptor<bool> arg_show_rpc_autodoc = { "show_rpc_autodoc", "Display rpc auto-generated documentation template" };
const arg_descriptor<bool> arg_disable_upnp = { "disable-upnp", "Disable UPnP (enhances local network privacy)", false, true };
}

View file

@ -184,4 +184,5 @@ namespace command_line
extern const arg_descriptor<bool> arg_console;
extern const arg_descriptor<bool> arg_show_details;
extern const arg_descriptor<bool> arg_show_rpc_autodoc;
extern const arg_descriptor<bool> arg_disable_upnp;
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Boolberry developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -725,7 +725,11 @@ namespace tools
}
~cached_key_value_accessor()
{
m_cache.clear(); //will clear cache isolated
NESTED_TRY_ENTRY();
m_cache.clear(); //will clear cache isolated
NESTED_CATCH_ENTRY(__func__);
}
void clear_cache() const

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -26,7 +26,11 @@ namespace tools
}
lmdb_db_backend::~lmdb_db_backend()
{
close();
NESTED_TRY_ENTRY();
close();
NESTED_CATCH_ENTRY(__func__);
}
bool lmdb_db_backend::open(const std::string& path_, uint64_t cache_sz)
@ -363,4 +367,4 @@ namespace tools
}
#undef LOG_DEFAULT_CHANNEL
#define LOG_DEFAULT_CHANNEL NULL
#define LOG_DEFAULT_CHANNEL NULL

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Boolberry developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -35,13 +35,18 @@ namespace tools
miniupnp_helper():m_devlist(nullptr),
m_urls(AUTO_VAL_INIT(m_urls)),
m_data(AUTO_VAL_INIT(m_data)),
m_IGD(0)
m_IGD(0),
m_external_port{}
{
m_lanaddr[0] = 0;
}
~miniupnp_helper()
{
NESTED_TRY_ENTRY();
deinit();
NESTED_CATCH_ENTRY(__func__);
}
bool start_regular_mapping(uint32_t internal_port, uint32_t external_port, uint32_t period_ms)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -24,6 +24,7 @@ using namespace epee;
#include "net/http_client.h"
#include "currency_core/genesis_acc.h"
#include <cstdlib>
namespace po = boost::program_options;
using namespace currency;
@ -1037,6 +1038,9 @@ bool handle_download_peer_log(po::variables_map& vm)
//---------------------------------------------------------------------------------------------------------------
int main(int argc, char* argv[])
{
try
{
TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
@ -1072,9 +1076,6 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_set_peer_log_level);
command_line::add_arg(desc_params, arg_download_peer_log);
command_line::add_arg(desc_params, arg_do_consloe_log);
po::options_description desc_all;
desc_all.add(desc_general).add(desc_params);
@ -1095,7 +1096,7 @@ int main(int argc, char* argv[])
return true;
});
if (!r)
return 1;
return EXIT_FAILURE;
if (command_line::has_arg(vm, arg_do_consloe_log) && command_line::get_arg(vm, arg_do_consloe_log))
{
log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
@ -1105,43 +1106,43 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_version))
{
std::cout << CURRENCY_NAME << " v" << PROJECT_VERSION_LONG << ENDL;
return 0;
return EXIT_SUCCESS;
}
if(command_line::has_arg(vm, arg_request_stat_info) || command_line::has_arg(vm, arg_request_net_state))
{
return handle_request_stat(vm, command_line::get_arg(vm, arg_peer_id)) ? 0:1;
return handle_request_stat(vm, command_line::get_arg(vm, arg_peer_id)) ? EXIT_SUCCESS : EXIT_FAILURE;
}
if(command_line::has_arg(vm, arg_get_daemon_info))
{
return handle_get_daemon_info(vm) ? 0:1;
return handle_get_daemon_info(vm) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if(command_line::has_arg(vm, arg_generate_keys))
{
return generate_and_print_keys() ? 0:1;
return generate_and_print_keys() ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if(command_line::has_arg(vm, arg_get_aliases))
{
return handle_get_aliases(vm) ? 0:1;
return handle_get_aliases(vm) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if(command_line::has_arg(vm, arg_upate_maintainers_info))
{
return handle_update_maintainers_info(vm) ? 0:1;
return handle_update_maintainers_info(vm) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if (command_line::has_arg(vm, arg_increment_build_no))
{
return handle_increment_build_no(vm) ? 0 : 1;
return handle_increment_build_no(vm) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if (command_line::has_arg(vm, arg_generate_genesis))
{
return generate_genesis(command_line::get_arg(vm, arg_generate_genesis), 10000000000000000) ? 0 : 1;
return generate_genesis(command_line::get_arg(vm, arg_generate_genesis), 10000000000000000) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if (command_line::has_arg(vm, arg_set_peer_log_level))
{
return handle_set_peer_log_level(vm) ? 0 : 1;
return handle_set_peer_log_level(vm) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else if (command_line::has_arg(vm, arg_download_peer_log))
{
return handle_download_peer_log(vm) ? 0 : 1;
return handle_download_peer_log(vm) ? EXIT_SUCCESS : EXIT_FAILURE;
}
else
{
@ -1149,6 +1150,13 @@ int main(int argc, char* argv[])
std::cerr << desc_all << ENDL;
}
return 1;
CATCH_ENTRY_L0(__func__, EXIT_FAILURE);
}
catch (...)
{
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -18,12 +18,20 @@
#include "crypto.h"
#include "hash.h"
#if !defined(NDEBUG)
# define crypto_assert(expression) assert(expression)
#else
# define crypto_assert(expression) ((void)0)
#endif
namespace crypto {
DISABLE_GCC_AND_CLANG_WARNING(strict-aliasing)
const unsigned char Z_[32] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const unsigned char I_[32] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
const unsigned char L_[32] = { 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 };
const key_image Z = *reinterpret_cast<const key_image*>(&Z_);
const key_image I = *reinterpret_cast<const key_image*>(&I_);
const key_image L = *reinterpret_cast<const key_image*>(&L_);
@ -141,8 +149,8 @@ namespace crypto {
{
ge_p3 A = ge_p3();
ge_p2 R = ge_p2();
// maybe use assert instead?
ge_frombytes_vartime(&A, reinterpret_cast<const unsigned char*>(&P));
if (ge_frombytes_vartime(&A, reinterpret_cast<const unsigned char*>(&P)) != 0)
return Z;
ge_scalarmult(&R, reinterpret_cast<const unsigned char*>(&a), &A);
key_image a_p = key_image();
ge_tobytes(reinterpret_cast<unsigned char*>(&a_p), &R);
@ -152,9 +160,8 @@ namespace crypto {
bool crypto_ops::validate_key_image(const key_image& ki)
{
if (!(scalarmult_key(ki, L) == I))
{
return false;
}
return true;
}
@ -172,7 +179,7 @@ namespace crypto {
ge_p3 point;
ge_p2 point2;
ge_p1p1 point3;
assert(sc_check(&key2) == 0);
crypto_assert(sc_check(&key2) == 0);
if (ge_frombytes_vartime(&point, &key1) != 0) {
return false;
}
@ -191,7 +198,11 @@ namespace crypto {
char *end = buf.output_index;
buf.derivation = derivation;
tools::write_varint(end, output_index);
assert(end <= buf.output_index + sizeof buf.output_index);
if (!(end <= buf.output_index + sizeof buf.output_index))
{
crypto_assert(false);
return;
}
hash_to_scalar(&buf, end - reinterpret_cast<char *>(&buf), res);
}
@ -218,7 +229,7 @@ namespace crypto {
void crypto_ops::derive_secret_key(const key_derivation &derivation, size_t output_index,
const secret_key &base, secret_key &derived_key) {
ec_scalar scalar;
assert(sc_check(&base) == 0);
crypto_assert(sc_check(&base) == 0);
derivation_to_scalar(derivation, output_index, scalar);
sc_add(&derived_key, &base, &scalar);
}
@ -238,10 +249,10 @@ namespace crypto {
{
ge_p3 t;
public_key t2;
assert(sc_check(&sec) == 0);
crypto_assert(sc_check(&sec) == 0);
ge_scalarmult_base(&t, &sec);
ge_p3_tobytes(&t2, &t);
assert(pub == t2);
crypto_assert(pub == t2);
}
#endif
buf.h = prefix_hash;
@ -258,7 +269,7 @@ namespace crypto {
ge_p3 tmp3;
ec_scalar c;
s_comm buf;
assert(check_key(pub));
crypto_assert(check_key(pub));
buf.h = prefix_hash;
buf.key = pub;
if (ge_frombytes_vartime(&tmp3, &pub) != 0) {
@ -287,7 +298,7 @@ namespace crypto {
void crypto_ops::generate_key_image(const public_key &pub, const secret_key &sec, key_image &image) {
ge_p3 point;
ge_p2 point2;
assert(sc_check(&sec) == 0);
crypto_assert(sc_check(&sec) == 0);
hash_to_ec(pub, point);
ge_scalarmult(&point2, &sec, &point);
ge_tobytes(&image, &point2);
@ -319,20 +330,24 @@ POP_WARNINGS
ge_dsmp image_pre;
ec_scalar sum, k, h;
rs_comm *const buf = reinterpret_cast<rs_comm *>(alloca(rs_comm_size(pubs_count)));
assert(sec_index < pubs_count);
if (!(sec_index < pubs_count))
{
crypto_assert(false);
return;
}
#if !defined(NDEBUG)
{
ge_p3 t;
public_key t2;
key_image t3;
assert(sc_check(&sec) == 0);
crypto_assert(sc_check(&sec) == 0);
ge_scalarmult_base(&t, &sec);
ge_p3_tobytes(&t2, &t);
assert(*pubs[sec_index] == t2);
crypto_assert(*pubs[sec_index] == t2);
generate_key_image(*pubs[sec_index], sec, t3);
assert(image == t3);
crypto_assert(image == t3);
for (i = 0; i < pubs_count; i++) {
assert(check_key(*pubs[i]));
crypto_assert(check_key(*pubs[i]));
}
}
#endif
@ -381,7 +396,7 @@ POP_WARNINGS
rs_comm *const buf = reinterpret_cast<rs_comm *>(alloca(rs_comm_size(pubs_count)));
#if !defined(NDEBUG)
for (i = 0; i < pubs_count; i++) {
assert(check_key(*pubs[i]));
crypto_assert(check_key(*pubs[i]));
}
#endif
if (ge_frombytes_vartime(&image_unp, &image) != 0) {

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Copyright (c) 2014-2015 The Boolberry developers
@ -389,7 +389,7 @@ namespace currency
{
public:
// tx version information
size_t version;
size_t version{};
//extra
std::vector<extra_v> extra;
std::vector<txin_v> vin;

View file

@ -47,8 +47,8 @@
#define BASE_REWARD_DUST_THRESHOLD ((uint64_t)1000000) // pow(10, 6) - change this will cause hard-fork!
#define DEFAULT_DUST_THRESHOLD ((uint64_t)0)//((uint64_t)100000) // pow(10, 5)
#define TX_DEFAULT_FEE ((uint64_t)10000000000) // pow(10, 5)
#define TX_MINIMUM_FEE ((uint64_t)100000) // pow(10, 5)
#define TX_DEFAULT_FEE ((uint64_t)10000000000) // .01
#define TX_MINIMUM_FEE ((uint64_t)10000000000) // .01
// #define CURRENCY_FIXED_REWARD_ZONE_HEIGHT 300 // blocks will have fixed reward up to this height (including)
// #define CURRENCY_FIXED_REWARD_ZONE_REWARD_AMOUNT ((uint64_t)100000000) // should be TX_MINIMUM_FEE * CURRENCY_FIXED_REWARD_ZONE_FEE_MULTIPLIER

View file

@ -181,7 +181,7 @@ namespace currency {
wide_difficulty_type next_difficulty(vector<uint64_t>& timestamps, vector<wide_difficulty_type>& cumulative_difficulties, size_t target_seconds)
{
TIME_MEASURE_START_PD(target_calculating_enum_blocks);
// timestamps - first is latest, back - is oldest timestamps
if (timestamps.size() > DIFFICULTY_WINDOW)
{

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -27,6 +27,8 @@ using namespace epee;
#include "version.h"
#include "currency_core/core_tools.h"
#include <cstdlib>
#if defined(WIN32)
#include <crtdbg.h>
#pragma comment(lib, "ntdll") // <-- why do we need this?
@ -43,6 +45,10 @@ bool command_line_preprocessor(const boost::program_options::variables_map& vm);
int main(int argc, char* argv[])
{
try
{
TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
#ifdef WIN32
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
@ -59,8 +65,6 @@ int main(int argc, char* argv[])
std::fflush(nullptr); // all open output streams are flushed
});
TRY_ENTRY();
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options", 130, 83);
@ -70,13 +74,14 @@ int main(int argc, char* argv[])
// tools::get_default_data_dir() can't be called during static initialization
command_line::add_arg(desc_cmd_only, command_line::arg_data_dir, tools::get_default_data_dir());
command_line::add_arg(desc_cmd_only, command_line::arg_config_file);
command_line::add_arg(desc_cmd_only, command_line::arg_disable_upnp);
command_line::add_arg(desc_cmd_sett, command_line::arg_log_dir);
command_line::add_arg(desc_cmd_sett, command_line::arg_log_level);
command_line::add_arg(desc_cmd_sett, command_line::arg_console);
command_line::add_arg(desc_cmd_sett, command_line::arg_show_details);
command_line::add_arg(desc_cmd_sett, command_line::arg_show_rpc_autodoc);
arg_market_disable.default_value = true;
arg_market_disable.not_use_default = false;
@ -124,7 +129,7 @@ int main(int argc, char* argv[])
return true;
});
if (!r)
return 1;
return EXIT_FAILURE;
//set up logging options
std::string log_dir;
@ -144,7 +149,7 @@ int main(int argc, char* argv[])
if (command_line_preprocessor(vm))
{
return 0;
return EXIT_SUCCESS;
}
@ -162,7 +167,6 @@ int main(int argc, char* argv[])
cprotocol.set_p2p_endpoint(&p2psrv);
ccore.set_currency_protocol(&cprotocol);
daemon_cmmands_handler dch(p2psrv, rpc_server);
tools::miniupnp_helper upnp_helper;
//ccore.get_blockchain_storage().get_attachment_services_manager().add_service(&offers_service);
std::shared_ptr<currency::stratum_server> stratum_server_ptr;
if (stratum_enabled)
@ -173,7 +177,7 @@ int main(int argc, char* argv[])
LOG_PRINT_L0("Dumping RPC auto-generated documents!");
epee::net_utils::http::http_request_info query_info;
epee::net_utils::http::http_response_info response_info;
epee::net_utils::connection_context_base conn_context;
epee::net_utils::connection_context_base conn_context;
std::string generate_reference = std::string("RPC_COMMANDS_LIST:\n");
bool call_found = false;
rpc_server.handle_http_request_map(query_info, response_info, conn_context, call_found, generate_reference);
@ -193,8 +197,12 @@ int main(int argc, char* argv[])
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize p2p server.");
LOG_PRINT_L0("P2p server initialized OK on port: " << p2psrv.get_this_peer_port());
LOG_PRINT_L0("Starting UPnP");
upnp_helper.start_regular_mapping(p2psrv.get_this_peer_port(), p2psrv.get_this_peer_port(), 20*60*1000);
if (!command_line::get_arg(vm, command_line::arg_disable_upnp))
{
tools::miniupnp_helper upnp_helper;
LOG_PRINT_L0("Starting UPnP");
upnp_helper.start_regular_mapping(p2psrv.get_this_peer_port(), p2psrv.get_this_peer_port(), 20*60*1000);
}
LOG_PRINT_L0("Initializing currency protocol...");
res = cprotocol.init(vm);
@ -220,7 +228,7 @@ int main(int argc, char* argv[])
}
auto& bcs = ccore.get_blockchain_storage();
if (!offers_service.is_disabled() && bcs.get_current_blockchain_size() > 1 && bcs.get_top_block_id() != offers_service.get_last_seen_block_id())
{
@ -301,9 +309,14 @@ int main(int argc, char* argv[])
cprotocol.set_p2p_endpoint(NULL);
LOG_PRINT("Node stopped.", LOG_LEVEL_0);
return 0;
return EXIT_SUCCESS;
CATCH_ENTRY_L0("main", 1);
CATCH_ENTRY_L0(__func__, EXIT_FAILURE);
}
catch (...)
{
return EXIT_FAILURE;
}
}
bool command_line_preprocessor(const boost::program_options::variables_map& vm)

View file

@ -1546,7 +1546,7 @@ void daemon_backend::wallet_vs_options::worker_func()
{
w->get()->build_minted_block(ctx.sp, ctx.rsp);
}
LOG_PRINT_L1(w->get()->get_log_prefix() + " PoS mint iteration finished(" << ctx.rsp.status << ")");
LOG_PRINT_L1(w->get()->get_log_prefix() + " PoS mint iteration finished(iterations: " << ctx.rsp.iterations_processed << "," << ctx.rsp.status << ")");
return true;
});
}

View file

@ -46,6 +46,18 @@
"COMPLETE": "Completion",
"SYNCING": "Syncing blockchain",
"LOADING": "Loading blockchain data"
},
"UPDATE": {
"STANDARD": "Update available",
"STANDARD_TOOLTIP": "<span class=\"standard-update\">Get new update.</span><br><span>Update is recommended!</span>",
"IMPORTANT": "Update available",
"IMPORTANT_HINT": "Important update!",
"IMPORTANT_TOOLTIP": "<span class=\"important-update\">Get new update.</span><br><span>Important update!</span>",
"CRITICAL": "Update available",
"CRITICAL_HINT": "Critical update!",
"CRITICAL_TOOLTIP": "<span class=\"critical-update\">Critical update available.</span><i class=\"icon\"></i><span>Update strongly recommended!</span>",
"TIME": "System time differs from network",
"TIME_TOOLTIP": "<span class=\"wrong-time\">Wrong system time!</span><br><span>Check and repair your system time.</span>"
}
},
"MAIN": {
@ -266,6 +278,7 @@
"HISTORY": {
"STATUS": "Status",
"STATUS_TOOLTIP": "Confirmations {{current}}/{{total}}",
"LOCK_TOOLTIP": "Locked till {{date}}",
"SEND": "Sent",
"RECEIVED": "Received",
"DATE": "Date",
@ -289,7 +302,8 @@
"COMPLETE_SELLER": "Successfully complete contract, receive payment on contract, and return pledge",
"CREATE_ALIAS": "Fee for assigning alias",
"UPDATE_ALIAS": "Fee for editing alias",
"MINED": "Mined funds",
"POW_REWARD": "POW reward",
"POS_REWARD": "POS reward",
"CREATE_CONTRACT": "Send contract offer",
"PLEDGE_CONTRACT": "Make pledge on offer",
"NULLIFY_CONTRACT": "Nullify pledges for contract",

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M26,15v-5c0-5.5-4.5-10-10-10h-0.1c-5.5,0-10,4.5-10,10v5H3v17h12.9H16h13V15H26z M9.9,10c0-3.3,2.7-6,6-6H16
c3.3,0,6,2.7,6,6v5H9.9V10z M14,27v-7h4v7H14z"/>
</svg>

After

Width:  |  Height:  |  Size: 582 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M12,0C5.4,0,0,5.4,0,12s5.4,12,12,12s12-5.4,12-12S18.6,0,12,0z M16.7,18.5L10,12.9V4h4v7.1l5.3,4.4L16.7,18.5z
"/>
</svg>

After

Width:  |  Height:  |  Size: 540 B

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M50,0C22.4,0,0,22.4,0,50s22.4,50,50,50s50-22.4,50-50S77.6,0,50,0z M54,70h-8v-8h8V70z M54,58h-8V30h8V58z"/>
</svg>

After

Width:  |  Height:  |  Size: 538 B

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M24,11L23,0l-3.1,3.1C17.8,1.2,15.1,0,12,0C6.1,0,1.1,4.3,0.2,10h4.1c0.9-3.4,4-6,7.7-6c2,0,3.7,0.7,5.1,1.9
L14,9L24,11z"/>
<path class="st0" d="M0,13l1,11l3.1-3.1C6.2,22.8,8.9,24,12,24c5.9,0,10.9-4.3,11.8-10h-4.1c-0.9,3.4-4,6-7.7,6
c-2,0-3.7-0.7-5.1-1.9L10,15L0,13z"/>
</svg>

After

Width:  |  Height:  |  Size: 696 B

View file

@ -375,9 +375,9 @@ input[type='checkbox'].style-checkbox {
&:after {
content: "";
position: absolute;
bottom: -2rem;
left: calc(50% - 1rem);
border-width: 1rem;
bottom: -1rem;
left: calc(50% - 0.5rem);
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
@ -394,11 +394,11 @@ input[type='checkbox'].style-checkbox {
position: absolute;
bottom: -1rem;
left: 0.7rem;
border-width: 1rem 1rem 0 0;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
border-color: themed(tooltipBackgroundColor) transparent transparent themed(tooltipBackgroundColor);
}
}
}
@ -426,9 +426,9 @@ input[type='checkbox'].style-checkbox {
&:before {
content: "";
position: absolute;
top: -2rem;
left: calc(50% - 1rem);
border-width: 1rem;
top: -1rem;
left: calc(50% - 0.5rem);
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
@ -477,13 +477,13 @@ input[type='checkbox'].style-checkbox {
&:after {
content: "";
position: absolute;
top: 0;
top: calc(50% - 0.5rem);
right: -1rem;
border-width: 1rem 1rem 0 0;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
border-color: transparent transparent transparent themed(tooltipBackgroundColor);
}
}
}
@ -494,13 +494,13 @@ input[type='checkbox'].style-checkbox {
&:before {
content: "";
position: absolute;
top: 0;
top: calc(50% - 0.5rem);
left: -1rem;
border-width: 1rem 0 0 1rem;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
border-color: transparent themed(tooltipBackgroundColor) transparent transparent;
}
}
}
@ -589,6 +589,162 @@ input[type='checkbox'].style-checkbox {
}
}
.update-tooltip {
padding: 1.5rem;
@include themify($themes) {
background: themed(tooltipBackgroundColor);
box-shadow: themed(tooltipShadow);
color: themed(mainTextColor);
}
&.important {
@include themify($themes) {
background: themed(tooltipImportantBackgroundColor);
color: themed(accountMainTextColor);
}
&.ng-tooltip-left-bottom {
&:after {
@include themify($themes) {
border-color: transparent transparent themed(tooltipImportantBackgroundColor) themed(tooltipImportantBackgroundColor);
}
}
}
&.ng-tooltip-right-bottom {
&:before {
@include themify($themes) {
border-color: transparent themed(tooltipImportantBackgroundColor) themed(tooltipImportantBackgroundColor) transparent;
}
}
}
}
&.critical {
padding: 2.5rem;
@include themify($themes) {
background: themed(tooltipCriticalBackgroundColor);
color: themed(accountMainTextColor);
}
.tooltip-inner {
display: flex;
flex-direction: column;
align-items: center;
}
&.ng-tooltip-left-bottom {
&:after {
@include themify($themes) {
border-color: transparent transparent themed(tooltipCriticalBackgroundColor) themed(tooltipCriticalBackgroundColor);
}
}
}
&.ng-tooltip-right-bottom {
&:before {
@include themify($themes) {
border-color: transparent themed(tooltipCriticalBackgroundColor) themed(tooltipCriticalBackgroundColor) transparent;
}
}
}
}
.tooltip-inner {
font-size: 1.3rem;
line-height: 1.8rem;
white-space: pre-wrap;
.standard-update {
font-size: 1.5rem;
line-height: 2.7rem;
@include themify($themes) {
color: themed(blueTextColor);
}
}
.important-update {
font-size: 1.5rem;
line-height: 2.7rem;
@include themify($themes) {
color: themed(tooltipImportantTextColor);
}
}
.critical-update {
font-size: 1.5rem;
line-height: 2.7rem;
text-align: center;
}
.wrong-time {
font-size: 1.5rem;
line-height: 2.7rem;
@include themify($themes) {
color: themed(tooltipImportantTextColor);
}
}
.icon {
margin: 1.5rem 0;
width: 5rem;
height: 5rem;
@include themify($themes) {
background-color: themed(tooltipCriticalTextColor);
}
}
}
&.ng-tooltip-left-bottom {
margin-left: -1.5rem;
&:after {
content: "";
position: absolute;
bottom: 0.6rem;
right: -1rem;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: transparent transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor);
}
}
}
&.ng-tooltip-right-bottom {
margin-left: 1.5rem;
&:before {
content: "";
position: absolute;
bottom: 0.6rem;
left: -1rem;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor) transparent;
}
}
}
}
.ngx-contextmenu {
.dropdown-menu {

View file

@ -11,6 +11,7 @@ $themes: (
optionalTextColor: #556576,
blueTextColor: #4db1ff,
greenTextColor: #5cda9d,
orangeTextColor: #ff6f00,
redTextColor: #ff5252,
blueButtonBackgroundColor: #4db1ff,
blueButtonHoverColor: #82d7ff,
@ -46,6 +47,10 @@ $themes: (
chartOptionsBackgroundColor: #2b3644,
chartOptionsHoverColor: #556576,
tooltipBackgroundColor: #42505f,
tooltipImportantTextColor: #ff6f00,
tooltipImportantBackgroundColor: #5f2b11,
tooltipCriticalTextColor: #ff5252,
tooltipCriticalBackgroundColor: #5f1d1d,
tooltipShadow: 0 0 1rem rgba(0, 0, 0, 0.5),
modalBackground: url(~src/assets/images/background-dark.png),
closeButtonColor: #556576
@ -62,6 +67,7 @@ $themes: (
optionalTextColor: #565c62,
blueTextColor: #42a5f5,
greenTextColor: #47cf8d,
orangeTextColor: #ff6f00,
redTextColor: #ff5252,
blueButtonBackgroundColor: #42a5f5,
blueButtonHoverColor: #86d6ff,
@ -97,6 +103,10 @@ $themes: (
chartOptionsBackgroundColor: #292d31,
chartOptionsHoverColor: #515960,
tooltipBackgroundColor: #3e464c,
tooltipImportantTextColor: #ff6f00,
tooltipImportantBackgroundColor: #55240d,
tooltipCriticalTextColor: #ff5252,
tooltipCriticalBackgroundColor: #4c1919,
tooltipShadow: 0 0 1rem rgba(0, 0, 0, 0.5),
modalBackground: url(~src/assets/images/background-gray.png),
closeButtonColor: #515960
@ -113,6 +123,7 @@ $themes: (
optionalTextColor: #a0a5ab,
blueTextColor: #2c95f1,
greenTextColor: #46c172,
orangeTextColor: #ff6f00,
redTextColor: #ff5252,
blueButtonBackgroundColor: #2c95f1,
blueButtonHoverColor: #5cb3ff,
@ -148,6 +159,10 @@ $themes: (
chartOptionsBackgroundColor: #e0e0e0,
chartOptionsHoverColor: #ffffff,
tooltipBackgroundColor: #ffffff,
tooltipImportantTextColor: #ffffff,
tooltipImportantBackgroundColor: #ef6c00,
tooltipCriticalTextColor: #ffffff,
tooltipCriticalBackgroundColor: #e53935,
tooltipShadow: 0 0 1rem rgba(120, 120, 120, 0.5),
modalBackground: url(~src/assets/images/background-white.png),
closeButtonColor: #43454b

View file

@ -202,31 +202,93 @@ app-sidebar {
background-color: themed(onlineColor);
}
}
}
.progress-bar-container {
.progress-bar-container {
.syncing {
.syncing {
.progress-bar {
@include themify($themes) {
background-color: themed(progressBarBackgroundColor);
}
.fill {
.progress-bar {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
background-color: themed(progressBarBackgroundColor);
}
.fill {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
}
}
}
}
}
.loading {
.loading {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
}
}
}
}
.update-container {
.standard {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
color: themed(blueTextColor);
}
}
.important {
@include themify($themes) {
color: themed(orangeTextColor);
}
}
.critical {
@include themify($themes) {
color: themed(redTextColor);
}
}
.time {
@include themify($themes) {
color: themed(orangeTextColor);
}
}
.icon {
&.standard {
@include themify($themes) {
background-color: themed(blueTextColor);
}
}
&.important {
@include themify($themes) {
background-color: themed(orangeTextColor);
}
}
&.critical {
@include themify($themes) {
background-color: themed(redTextColor);
}
}
&.time {
@include themify($themes) {
background-color: themed(orangeTextColor);
}
}
}
}

View file

@ -140,6 +140,13 @@ app-history {
tr {
&.locked-transaction {
@include themify($themes) {
color: themed(optionalTextColor);
}
}
&:nth-child(4n+1) {
@include themify($themes) {
@ -185,17 +192,30 @@ app-history {
}
}
.lock-transaction {
@include themify($themes) {
background-color: themed(orangeTextColor);
}
}
.status.send {
.icon {
background-color: #ff5252;
.status-transaction {
@include themify($themes) {
background-color: themed(redTextColor);
}
}
}
.status.received {
.icon {
background-color: #00c853;
.status-transaction {
@include themify($themes) {
background-color: themed(greenTextColor);
}
}
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M26,15v-5c0-5.5-4.5-10-10-10h-0.1c-5.5,0-10,4.5-10,10v5H3v17h12.9H16h13V15H26z M9.9,10c0-3.3,2.7-6,6-6H16
c3.3,0,6,2.7,6,6v5H9.9V10z M14,27v-7h4v7H14z"/>
</svg>

After

Width:  |  Height:  |  Size: 582 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M12,0C5.4,0,0,5.4,0,12s5.4,12,12,12s12-5.4,12-12S18.6,0,12,0z M16.7,18.5L10,12.9V4h4v7.1l5.3,4.4L16.7,18.5z
"/>
</svg>

After

Width:  |  Height:  |  Size: 540 B

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M50,0C22.4,0,0,22.4,0,50s22.4,50,50,50s50-22.4,50-50S77.6,0,50,0z M54,70h-8v-8h8V70z M54,58h-8V30h8V58z"/>
</svg>

After

Width:  |  Height:  |  Size: 538 B

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M24,11L23,0l-3.1,3.1C17.8,1.2,15.1,0,12,0C6.1,0,1.1,4.3,0.2,10h4.1c0.9-3.4,4-6,7.7-6c2,0,3.7,0.7,5.1,1.9
L14,9L24,11z"/>
<path class="st0" d="M0,13l1,11l3.1-3.1C6.2,22.8,8.9,24,12,24c5.9,0,10.9-4.3,11.8-10h-4.1c-0.9,3.4-4,6-7.7,6
c-2,0-3.7-0.7-5.1-1.9L10,15L0,13z"/>
</svg>

After

Width:  |  Height:  |  Size: 696 B

View file

@ -176,13 +176,29 @@ export class TooltipDirective implements OnDestroy {
}
break;
case 'left':
this.renderer.setStyle(this.tooltip, 'left', hostPos.left - this.tooltip.getBoundingClientRect().width + 'px');
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + (hostPos.bottom - hostPos.top) / 2 - this.tooltip.getBoundingClientRect().height / 2 + 'px');
break;
case 'left-top':
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + 'px');
this.renderer.setStyle(this.tooltip, 'left', hostPos.left - this.tooltip.getBoundingClientRect().width + 'px');
break;
case 'left-bottom':
this.renderer.setStyle(this.tooltip, 'left', hostPos.left - this.tooltip.getBoundingClientRect().width + 'px');
this.renderer.setStyle(this.tooltip, 'top', hostPos.bottom - this.tooltip.getBoundingClientRect().height + 'px');
break;
case 'right':
this.renderer.setStyle(this.tooltip, 'left', hostPos.right + 'px');
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + (hostPos.bottom - hostPos.top) / 2 - this.tooltip.getBoundingClientRect().height / 2 + 'px');
break;
case 'right-top':
this.renderer.setStyle(this.tooltip, 'top', hostPos.top + 'px');
this.renderer.setStyle(this.tooltip, 'left', hostPos.right + 'px');
break;
case 'right-bottom':
this.renderer.setStyle(this.tooltip, 'left', hostPos.right + 'px');
this.renderer.setStyle(this.tooltip, 'top', hostPos.bottom - this.tooltip.getBoundingClientRect().height + 'px');
break;
}
}

View file

@ -33,7 +33,8 @@ export class Wallet {
amount: null,
comment: null,
mixin: null,
fee: null
fee: null,
hide: null
};
constructor(id, name, pass, path, address, balance, unlocked_balance, mined = 0, tracking = '') {

View file

@ -43,7 +43,7 @@ export class HistoryTypeMessagesPipe implements PipeTransform {
case 5:
return this.translate.instant('HISTORY.TYPE_MESSAGES.UPDATE_ALIAS');
case 6:
return this.translate.instant('HISTORY.TYPE_MESSAGES.MINED');
return (item.td['spn'] && item.td['spn'].length) ? this.translate.instant('HISTORY.TYPE_MESSAGES.POS_REWARD') : this.translate.instant('HISTORY.TYPE_MESSAGES.POW_REWARD');
case 7:
return this.translate.instant('HISTORY.TYPE_MESSAGES.CREATE_CONTRACT');
case 8:

View file

@ -19,8 +19,10 @@ export class VariablesService {
public defaultCurrency = 'ZANO';
public opening_wallet: Wallet;
public exp_med_ts = 0;
public ts_diff = 0;
public height_app = 0;
public last_build_available = '';
public last_build_displaymode = 0;
public daemon_state = 3;
public sync = {
progress_value: 0,
@ -75,6 +77,7 @@ export class VariablesService {
setExpMedTs(timestamp: number) {
if (timestamp !== this.exp_med_ts) {
this.exp_med_ts = timestamp;
this.ts_diff = Math.abs(new Date().getTime() - (timestamp * 1000));
this.getExpMedTsEvent.next(timestamp);
}
}

View file

@ -24,6 +24,12 @@ export class AppComponent implements OnInit, OnDestroy {
needOpenWallets = [];
currenciesFromNet = {
ZANO_bitmesh: null,
ZANO_qtrade: null,
BTC_bitmesh: null
};
@ViewChild('allContextMenu') public allContextMenu: ContextMenuComponent;
@ViewChild('onlyCopyContextMenu') public onlyCopyContextMenu: ContextMenuComponent;
@ -169,6 +175,7 @@ export class AppComponent implements OnInit, OnDestroy {
// this.variablesService.exp_med_ts = data['expiration_median_timestamp'] + 600 + 1;
this.variablesService.setExpMedTs(data['expiration_median_timestamp'] + 600 + 1);
this.variablesService.last_build_available = data.last_build_available;
this.variablesService.last_build_displaymode = data.last_build_displaymode;
this.variablesService.setHeightApp(data.height);
this.ngZone.run(() => {
@ -547,18 +554,52 @@ export class AppComponent implements OnInit, OnDestroy {
this.getMoneyEquivalent();
}
recountMoneyEquivalent() {
let sum = 0;
let count = 0;
if (this.currenciesFromNet.BTC_bitmesh) {
if (this.currenciesFromNet.ZANO_qtrade) {
sum += this.currenciesFromNet.ZANO_qtrade;
count++;
}
if (this.currenciesFromNet.ZANO_bitmesh) {
sum += this.currenciesFromNet.ZANO_bitmesh;
count++;
}
}
this.variablesService.moneyEquivalent = (sum / count) / this.currenciesFromNet.BTC_bitmesh;
}
getMoneyEquivalent() {
this.http.get('https://api.coinmarketcap.com/v2/ticker/406').subscribe(
result => {
if (result.hasOwnProperty('data')) {
this.variablesService.moneyEquivalent = result['data']['quotes']['USD']['price'];
}
this.http.get('https://blockchain.info/tobtc?currency=USD&value=1').subscribe(
result1 => {
this.currenciesFromNet.BTC_bitmesh = result1;
this.http.get('https://api.qtrade.io/v1/ticker/ZANO_BTC').subscribe(
result2 => {
if (result2.hasOwnProperty('data')) {
this.currenciesFromNet.ZANO_qtrade = (parseFloat(result2['data']['ask']) + parseFloat(result2['data']['bid'])) / 2;
}
this.recountMoneyEquivalent();
},
() => {
}
);
this.http.get('https://api.bitmesh.com/?api=market.statistics&params={"market":"btc_zano"}').subscribe(
result3 => {
if (result3.hasOwnProperty('data')) {
this.currenciesFromNet.ZANO_bitmesh = parseFloat(result3['data']['price']);
}
this.recountMoneyEquivalent();
},
() => {
}
);
},
error => {
setTimeout(() => {
this.getMoneyEquivalent();
}, 60000);
console.warn('Error coinmarketcap', error);
console.warn('Error', error);
}
);
}

View file

@ -12,7 +12,7 @@
</thead>
<tbody>
<ng-container *ngFor="let item of variablesService.currentWallet.history">
<tr (click)="openDetails(item.tx_hash)">
<tr (click)="openDetails(item.tx_hash)" [class.locked-transaction]="false">
<td>
<div class="status" [class.send]="!item.is_income" [class.received]="item.is_income">
<ng-container *ngIf="variablesService.height_app - item.height < 10 || item.height === 0 && item.timestamp > 0">
@ -20,7 +20,10 @@
<div class="fill" [style.height]="getHeight(item) + '%'"></div>
</div>
</ng-container>
<i class="icon"></i>
<ng-container *ngIf="false">
<i class="icon lock-transaction" tooltip="{{ 'HISTORY.LOCK_TOOLTIP' | translate : {'date': item.timestamp * 1000 | date : 'MM.dd.yy'} }}" placement="bottom-left" tooltipClass="table-tooltip" [delay]="500"></i>
</ng-container>
<i class="icon status-transaction"></i>
<span>{{ (item.is_income ? 'HISTORY.RECEIVED' : 'HISTORY.SEND') | translate }}</span>
</div>
</td>

View file

@ -35,7 +35,17 @@
}
}
.icon {
.lock-transaction {
position: absolute;
top: 50%;
left: -2rem;
transform: translateY(-50%);
mask: url(../../assets/icons/lock-transaction.svg) no-repeat center;
width: 1.2rem;
height: 1.2rem;
}
.status-transaction {
margin-right: 1rem;
width: 1.7rem;
height: 1.7rem;
@ -43,14 +53,14 @@
&.send {
.icon {
.status-transaction {
mask: url(../../assets/icons/send.svg) no-repeat center;
}
}
&.received {
.icon {
.status-transaction {
mask: url(../../assets/icons/receive.svg) no-repeat center;
}
}

View file

@ -15,7 +15,7 @@ export class HistoryComponent implements OnInit, OnDestroy, AfterViewChecked {
constructor(
private route: ActivatedRoute,
private variablesService: VariablesService
public variablesService: VariablesService
) {}
ngOnInit() {

View file

@ -126,7 +126,8 @@ export class SendComponent implements OnInit, OnDestroy {
amount: this.variablesService.currentWallet.send_data['amount'],
comment: this.variablesService.currentWallet.send_data['comment'],
mixin: this.variablesService.currentWallet.send_data['mixin'] || 0,
fee: this.variablesService.currentWallet.send_data['fee'] || this.variablesService.default_fee
fee: this.variablesService.currentWallet.send_data['fee'] || this.variablesService.default_fee,
hide: this.variablesService.currentWallet.send_data['hide'] || false
});
});
}
@ -151,8 +152,8 @@ export class SendComponent implements OnInit, OnDestroy {
(send_status) => {
if (send_status) {
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null};
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee});
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null, hide: null};
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee, hide: false});
}
});
}
@ -176,8 +177,8 @@ export class SendComponent implements OnInit, OnDestroy {
(send_status) => {
if (send_status) {
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null};
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee});
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null, hide: null};
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee, hide: false});
}
});
}
@ -198,7 +199,8 @@ export class SendComponent implements OnInit, OnDestroy {
amount: this.sendForm.get('amount').value,
comment: this.sendForm.get('comment').value,
mixin: this.sendForm.get('mixin').value,
fee: this.sendForm.get('fee').value
fee: this.sendForm.get('fee').value,
hide: this.sendForm.get('hide').value
};
}

View file

@ -71,14 +71,44 @@
<span class="online" *ngIf="variablesService.daemon_state === 5">
{{ 'SIDEBAR.SYNCHRONIZATION.COMPLETE' | translate }}
</span>
</div>
<div class="progress-bar-container">
<div class="syncing" *ngIf="variablesService.daemon_state === 1">
<div class="progress-bar">
<div class="fill" [style.width]="variablesService.sync.progress_value + '%'"></div>
<div class="progress-bar-container" *ngIf="variablesService.daemon_state === 1 || variablesService.daemon_state === 3">
<div class="syncing" *ngIf="variablesService.daemon_state === 1">
<div class="progress-bar">
<div class="fill" [style.width]="variablesService.sync.progress_value + '%'"></div>
</div>
<div class="progress-percent">{{ variablesService.sync.progress_value_text }}%</div>
</div>
<div class="progress-percent">{{ variablesService.sync.progress_value_text }}%</div>
<div class="loading" *ngIf="variablesService.daemon_state === 3"></div>
</div>
<div class="loading" *ngIf="variablesService.daemon_state === 3"></div>
</div>
<div class="update-container" *ngIf="(variablesService.daemon_state === 0 || variablesService.daemon_state === 2) && [2, 3, 4].indexOf(variablesService.last_build_displaymode) !== -1">
<ng-container *ngIf="variablesService.last_build_displaymode === 2">
<div class="update-text standard">
<span [style.cursor]="'pointer'" (click)="getUpdate()">{{ 'SIDEBAR.UPDATE.STANDARD' | translate }}</span>
</div>
<i class="icon update standard" tooltip="{{ 'SIDEBAR.UPDATE.STANDARD_TOOLTIP' | translate }}" placement="right-bottom" tooltipClass="update-tooltip" [delay]="500"></i>
</ng-container>
<ng-container *ngIf="variablesService.last_build_displaymode === 3">
<div class="update-text important">
<span [style.cursor]="'pointer'" (click)="getUpdate()">{{ 'SIDEBAR.UPDATE.IMPORTANT' | translate }}</span>
<br>
<span style="font-size: 1rem">{{ 'SIDEBAR.UPDATE.IMPORTANT_HINT' | translate }}</span>
</div>
<i class="icon update important" tooltip="{{ 'SIDEBAR.UPDATE.IMPORTANT_TOOLTIP' | translate }}" placement="right-bottom" tooltipClass="update-tooltip important" [delay]="500"></i>
</ng-container>
<ng-container *ngIf="variablesService.last_build_displaymode === 4">
<div class="update-text critical">
<span [style.cursor]="'pointer'" (click)="getUpdate()">{{ 'SIDEBAR.UPDATE.CRITICAL' | translate }}</span>
<br>
<span style="font-size: 1rem">{{ 'SIDEBAR.UPDATE.IMPORTANT_HINT' | translate }}</span>
</div>
<i class="icon update critical" tooltip="{{ 'SIDEBAR.UPDATE.CRITICAL_TOOLTIP' | translate }}" placement="right-bottom" tooltipClass="update-tooltip critical" [delay]="500"></i>
</ng-container>
</div>
<div class="update-container" *ngIf="variablesService.daemon_state === 2 && variablesService.ts_diff > (10 * 60 * 1000)">
<div class="update-text time">
<span>{{ 'SIDEBAR.UPDATE.TIME' | translate }}</span>
</div>
<i class="icon time" tooltip="{{ 'SIDEBAR.UPDATE.TIME_TOOLTIP' | translate }}" placement="right-bottom" tooltipClass="update-tooltip important" [delay]="500"></i>
</div>
</div>

View file

@ -3,7 +3,7 @@
flex-direction: column;
justify-content: space-between;
flex: 0 0 25rem;
padding: 0 3rem 3rem;
padding: 0 3rem;
max-width: 25rem;
}
@ -216,14 +216,16 @@
}
.sidebar-synchronization-status {
position: relative;
display: flex;
align-items: flex-end;
align-items: center;
justify-content: flex-start;
flex: 0 0 4rem;
flex: 0 0 7rem;
font-size: 1.3rem;
.status-container {
position: relative;
flex-grow: 1;
text-align: left;
.offline, .online {
position: relative;
@ -245,61 +247,94 @@
.syncing, .loading {
line-height: 4rem;
}
}
.progress-bar-container {
position: absolute;
bottom: -0.7rem;
left: 0;
height: 0.7rem;
width: 100%;
.progress-bar-container {
position: absolute;
bottom: 0;
left: 0;
height: 0.7rem;
width: 100%;
.syncing {
display: flex;
.syncing {
display: flex;
.progress-bar {
flex: 1 0 auto;
.progress-bar {
flex: 1 0 auto;
.fill {
height: 100%;
.fill {
height: 100%;
}
}
.progress-percent {
flex: 0 0 auto;
font-size: 1.3rem;
line-height: 0.7rem;
padding-left: 0.7rem;
}
}
.progress-percent {
flex: 0 0 auto;
font-size: 1.3rem;
line-height: 0.7rem;
padding-left: 0.7rem;
.loading {
animation: move 5s linear infinite;
background-image:
-webkit-gradient(
linear, 0 0, 100% 100%,
color-stop(.125, rgba(0, 0, 0, .15)), color-stop(.125, transparent),
color-stop(.250, transparent), color-stop(.250, rgba(0, 0, 0, .10)),
color-stop(.375, rgba(0, 0, 0, .10)), color-stop(.375, transparent),
color-stop(.500, transparent), color-stop(.500, rgba(0, 0, 0, .15)),
color-stop(.625, rgba(0, 0, 0, .15)), color-stop(.625, transparent),
color-stop(.750, transparent), color-stop(.750, rgba(0, 0, 0, .10)),
color-stop(.875, rgba(0, 0, 0, .10)), color-stop(.875, transparent),
to(transparent)
),
-webkit-gradient(
linear, 0 100%, 100% 0,
color-stop(.125, rgba(0, 0, 0, .30)), color-stop(.125, transparent),
color-stop(.250, transparent), color-stop(.250, rgba(0, 0, 0, .25)),
color-stop(.375, rgba(0, 0, 0, .25)), color-stop(.375, transparent),
color-stop(.500, transparent), color-stop(.500, rgba(0, 0, 0, .30)),
color-stop(.625, rgba(0, 0, 0, .30)), color-stop(.625, transparent),
color-stop(.750, transparent), color-stop(.750, rgba(0, 0, 0, .25)),
color-stop(.875, rgba(0, 0, 0, .25)), color-stop(.875, transparent),
to(transparent)
);
background-size: 7rem 7rem;
height: 100%;
}
}
}
.update-container {
display: flex;
flex-grow: 1;
margin-left: 1rem;
text-align: right;
.update-text {
flex: 1 1 auto;
font-size: 1.2rem;
line-height: 1.8rem;
text-align: left;
&.time {
font-size: 1.1rem;
}
}
.loading {
animation: move 5s linear infinite;
background-image:
-webkit-gradient(
linear, 0 0, 100% 100%,
color-stop(.125, rgba(0, 0, 0, .15)), color-stop(.125, transparent),
color-stop(.250, transparent), color-stop(.250, rgba(0, 0, 0, .10)),
color-stop(.375, rgba(0, 0, 0, .10)), color-stop(.375, transparent),
color-stop(.500, transparent), color-stop(.500, rgba(0, 0, 0, .15)),
color-stop(.625, rgba(0, 0, 0, .15)), color-stop(.625, transparent),
color-stop(.750, transparent), color-stop(.750, rgba(0, 0, 0, .10)),
color-stop(.875, rgba(0, 0, 0, .10)), color-stop(.875, transparent),
to(transparent)
),
-webkit-gradient(
linear, 0 100%, 100% 0,
color-stop(.125, rgba(0, 0, 0, .30)), color-stop(.125, transparent),
color-stop(.250, transparent), color-stop(.250, rgba(0, 0, 0, .25)),
color-stop(.375, rgba(0, 0, 0, .25)), color-stop(.375, transparent),
color-stop(.500, transparent), color-stop(.500, rgba(0, 0, 0, .30)),
color-stop(.625, rgba(0, 0, 0, .30)), color-stop(.625, transparent),
color-stop(.750, transparent), color-stop(.750, rgba(0, 0, 0, .25)),
color-stop(.875, rgba(0, 0, 0, .25)), color-stop(.875, transparent),
to(transparent)
);
background-size: 7rem 7rem;
height: 100%;
.icon {
flex: 1 0 auto;
margin: 0.3rem 0 0 0.6rem;
width: 1.2rem;
height: 1.2rem;
&.update {
mask: url(../../assets/icons/update.svg) no-repeat center;
}
&.time {
mask: url(../../assets/icons/time.svg) no-repeat center;
}
}
}
}

View file

@ -1,6 +1,7 @@
import {Component, NgZone, OnInit, OnDestroy} from '@angular/core';
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
import {VariablesService} from '../_helpers/services/variables.service';
import {BackendService} from '../_helpers/services/backend.service';
@Component({
selector: 'app-sidebar',
@ -16,6 +17,7 @@ export class SidebarComponent implements OnInit, OnDestroy {
private route: ActivatedRoute,
private router: Router,
public variablesService: VariablesService,
private backend: BackendService,
private ngZone: NgZone
) {}
@ -47,6 +49,10 @@ export class SidebarComponent implements OnInit, OnDestroy {
});
}
getUpdate() {
this.backend.openUrlInBrowser('docs.zano.org/docs/zano-wallet');
}
logOut() {
this.variablesService.stopCountdown();
this.variablesService.appLogin = false;

View file

@ -46,6 +46,18 @@
"COMPLETE": "Completion",
"SYNCING": "Syncing blockchain",
"LOADING": "Loading blockchain data"
},
"UPDATE": {
"STANDARD": "Update available",
"STANDARD_TOOLTIP": "<span class=\"standard-update\">Get new update.</span><br><span>Update is recommended!</span>",
"IMPORTANT": "Update available",
"IMPORTANT_HINT": "Important update!",
"IMPORTANT_TOOLTIP": "<span class=\"important-update\">Get new update.</span><br><span>Important update!</span>",
"CRITICAL": "Update available",
"CRITICAL_HINT": "Critical update!",
"CRITICAL_TOOLTIP": "<span class=\"critical-update\">Critical update available.</span><i class=\"icon\"></i><span>Update strongly recommended!</span>",
"TIME": "System time differs from network",
"TIME_TOOLTIP": "<span class=\"wrong-time\">Wrong system time!</span><br><span>Check and repair your system time.</span>"
}
},
"MAIN": {
@ -266,6 +278,7 @@
"HISTORY": {
"STATUS": "Status",
"STATUS_TOOLTIP": "Confirmations {{current}}/{{total}}",
"LOCK_TOOLTIP": "Locked till {{date}}",
"SEND": "Sent",
"RECEIVED": "Received",
"DATE": "Date",
@ -289,7 +302,8 @@
"COMPLETE_SELLER": "Successfully complete contract, receive payment on contract, and return pledge",
"CREATE_ALIAS": "Fee for assigning alias",
"UPDATE_ALIAS": "Fee for editing alias",
"MINED": "Mined funds",
"POW_REWARD": "POW reward",
"POS_REWARD": "POS reward",
"CREATE_CONTRACT": "Send contract offer",
"PLEDGE_CONTRACT": "Make pledge on offer",
"NULLIFY_CONTRACT": "Nullify pledges for contract",

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M26,15v-5c0-5.5-4.5-10-10-10h-0.1c-5.5,0-10,4.5-10,10v5H3v17h12.9H16h13V15H26z M9.9,10c0-3.3,2.7-6,6-6H16
c3.3,0,6,2.7,6,6v5H9.9V10z M14,27v-7h4v7H14z"/>
</svg>

After

Width:  |  Height:  |  Size: 582 B

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M12,0C5.4,0,0,5.4,0,12s5.4,12,12,12s12-5.4,12-12S18.6,0,12,0z M16.7,18.5L10,12.9V4h4v7.1l5.3,4.4L16.7,18.5z
"/>
</svg>

After

Width:  |  Height:  |  Size: 540 B

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M50,0C22.4,0,0,22.4,0,50s22.4,50,50,50s50-22.4,50-50S77.6,0,50,0z M54,70h-8v-8h8V70z M54,58h-8V30h8V58z"/>
</svg>

After

Width:  |  Height:  |  Size: 538 B

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M24,11L23,0l-3.1,3.1C17.8,1.2,15.1,0,12,0C6.1,0,1.1,4.3,0.2,10h4.1c0.9-3.4,4-6,7.7-6c2,0,3.7,0.7,5.1,1.9
L14,9L24,11z"/>
<path class="st0" d="M0,13l1,11l3.1-3.1C6.2,22.8,8.9,24,12,24c5.9,0,10.9-4.3,11.8-10h-4.1c-0.9,3.4-4,6-7.7,6
c-2,0-3.7-0.7-5.1-1.9L10,15L0,13z"/>
</svg>

After

Width:  |  Height:  |  Size: 696 B

View file

@ -375,9 +375,9 @@ input[type='checkbox'].style-checkbox {
&:after {
content: "";
position: absolute;
bottom: -2rem;
left: calc(50% - 1rem);
border-width: 1rem;
bottom: -1rem;
left: calc(50% - 0.5rem);
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
@ -394,11 +394,11 @@ input[type='checkbox'].style-checkbox {
position: absolute;
bottom: -1rem;
left: 0.7rem;
border-width: 1rem 1rem 0 0;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
border-color: themed(tooltipBackgroundColor) transparent transparent themed(tooltipBackgroundColor);
}
}
}
@ -426,9 +426,9 @@ input[type='checkbox'].style-checkbox {
&:before {
content: "";
position: absolute;
top: -2rem;
left: calc(50% - 1rem);
border-width: 1rem;
top: -1rem;
left: calc(50% - 0.5rem);
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
@ -477,13 +477,13 @@ input[type='checkbox'].style-checkbox {
&:after {
content: "";
position: absolute;
top: 0;
top: calc(50% - 0.5rem);
right: -1rem;
border-width: 1rem 1rem 0 0;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
border-color: transparent transparent transparent themed(tooltipBackgroundColor);
}
}
}
@ -494,13 +494,13 @@ input[type='checkbox'].style-checkbox {
&:before {
content: "";
position: absolute;
top: 0;
top: calc(50% - 0.5rem);
left: -1rem;
border-width: 1rem 0 0 1rem;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: themed(tooltipBackgroundColor) transparent transparent transparent;
border-color: transparent themed(tooltipBackgroundColor) transparent transparent;
}
}
}
@ -589,6 +589,162 @@ input[type='checkbox'].style-checkbox {
}
}
.update-tooltip {
padding: 1.5rem;
@include themify($themes) {
background: themed(tooltipBackgroundColor);
box-shadow: themed(tooltipShadow);
color: themed(mainTextColor);
}
&.important {
@include themify($themes) {
background: themed(tooltipImportantBackgroundColor);
color: themed(accountMainTextColor);
}
&.ng-tooltip-left-bottom {
&:after {
@include themify($themes) {
border-color: transparent transparent themed(tooltipImportantBackgroundColor) themed(tooltipImportantBackgroundColor);
}
}
}
&.ng-tooltip-right-bottom {
&:before {
@include themify($themes) {
border-color: transparent themed(tooltipImportantBackgroundColor) themed(tooltipImportantBackgroundColor) transparent;
}
}
}
}
&.critical {
padding: 2.5rem;
@include themify($themes) {
background: themed(tooltipCriticalBackgroundColor);
color: themed(accountMainTextColor);
}
.tooltip-inner {
display: flex;
flex-direction: column;
align-items: center;
}
&.ng-tooltip-left-bottom {
&:after {
@include themify($themes) {
border-color: transparent transparent themed(tooltipCriticalBackgroundColor) themed(tooltipCriticalBackgroundColor);
}
}
}
&.ng-tooltip-right-bottom {
&:before {
@include themify($themes) {
border-color: transparent themed(tooltipCriticalBackgroundColor) themed(tooltipCriticalBackgroundColor) transparent;
}
}
}
}
.tooltip-inner {
font-size: 1.3rem;
line-height: 1.8rem;
white-space: pre-wrap;
.standard-update {
font-size: 1.5rem;
line-height: 2.7rem;
@include themify($themes) {
color: themed(blueTextColor);
}
}
.important-update {
font-size: 1.5rem;
line-height: 2.7rem;
@include themify($themes) {
color: themed(tooltipImportantTextColor);
}
}
.critical-update {
font-size: 1.5rem;
line-height: 2.7rem;
text-align: center;
}
.wrong-time {
font-size: 1.5rem;
line-height: 2.7rem;
@include themify($themes) {
color: themed(tooltipImportantTextColor);
}
}
.icon {
margin: 1.5rem 0;
width: 5rem;
height: 5rem;
@include themify($themes) {
background-color: themed(tooltipCriticalTextColor);
}
}
}
&.ng-tooltip-left-bottom {
margin-left: -1.5rem;
&:after {
content: "";
position: absolute;
bottom: 0.6rem;
right: -1rem;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: transparent transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor);
}
}
}
&.ng-tooltip-right-bottom {
margin-left: 1.5rem;
&:before {
content: "";
position: absolute;
bottom: 0.6rem;
left: -1rem;
border-width: 0.5rem;
border-style: solid;
@include themify($themes) {
border-color: transparent themed(tooltipBackgroundColor) themed(tooltipBackgroundColor) transparent;
}
}
}
}
.ngx-contextmenu {
.dropdown-menu {

View file

@ -11,6 +11,7 @@ $themes: (
optionalTextColor: #556576,
blueTextColor: #4db1ff,
greenTextColor: #5cda9d,
orangeTextColor: #ff6f00,
redTextColor: #ff5252,
blueButtonBackgroundColor: #4db1ff,
blueButtonHoverColor: #82d7ff,
@ -46,6 +47,10 @@ $themes: (
chartOptionsBackgroundColor: #2b3644,
chartOptionsHoverColor: #556576,
tooltipBackgroundColor: #42505f,
tooltipImportantTextColor: #ff6f00,
tooltipImportantBackgroundColor: #5f2b11,
tooltipCriticalTextColor: #ff5252,
tooltipCriticalBackgroundColor: #5f1d1d,
tooltipShadow: 0 0 1rem rgba(0, 0, 0, 0.5),
modalBackground: url(~src/assets/images/background-dark.png),
closeButtonColor: #556576
@ -62,6 +67,7 @@ $themes: (
optionalTextColor: #565c62,
blueTextColor: #42a5f5,
greenTextColor: #47cf8d,
orangeTextColor: #ff6f00,
redTextColor: #ff5252,
blueButtonBackgroundColor: #42a5f5,
blueButtonHoverColor: #86d6ff,
@ -97,6 +103,10 @@ $themes: (
chartOptionsBackgroundColor: #292d31,
chartOptionsHoverColor: #515960,
tooltipBackgroundColor: #3e464c,
tooltipImportantTextColor: #ff6f00,
tooltipImportantBackgroundColor: #55240d,
tooltipCriticalTextColor: #ff5252,
tooltipCriticalBackgroundColor: #4c1919,
tooltipShadow: 0 0 1rem rgba(0, 0, 0, 0.5),
modalBackground: url(~src/assets/images/background-gray.png),
closeButtonColor: #515960
@ -113,6 +123,7 @@ $themes: (
optionalTextColor: #a0a5ab,
blueTextColor: #2c95f1,
greenTextColor: #46c172,
orangeTextColor: #ff6f00,
redTextColor: #ff5252,
blueButtonBackgroundColor: #2c95f1,
blueButtonHoverColor: #5cb3ff,
@ -148,6 +159,10 @@ $themes: (
chartOptionsBackgroundColor: #e0e0e0,
chartOptionsHoverColor: #ffffff,
tooltipBackgroundColor: #ffffff,
tooltipImportantTextColor: #ffffff,
tooltipImportantBackgroundColor: #ef6c00,
tooltipCriticalTextColor: #ffffff,
tooltipCriticalBackgroundColor: #e53935,
tooltipShadow: 0 0 1rem rgba(120, 120, 120, 0.5),
modalBackground: url(~src/assets/images/background-white.png),
closeButtonColor: #43454b

View file

@ -202,31 +202,93 @@ app-sidebar {
background-color: themed(onlineColor);
}
}
}
.progress-bar-container {
.progress-bar-container {
.syncing {
.syncing {
.progress-bar {
@include themify($themes) {
background-color: themed(progressBarBackgroundColor);
}
.fill {
.progress-bar {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
background-color: themed(progressBarBackgroundColor);
}
.fill {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
}
}
}
}
}
.loading {
.loading {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
}
}
}
}
.update-container {
.standard {
@include themify($themes) {
background-color: themed(progressBarFullBackgroundColor);
color: themed(blueTextColor);
}
}
.important {
@include themify($themes) {
color: themed(orangeTextColor);
}
}
.critical {
@include themify($themes) {
color: themed(redTextColor);
}
}
.time {
@include themify($themes) {
color: themed(orangeTextColor);
}
}
.icon {
&.standard {
@include themify($themes) {
background-color: themed(blueTextColor);
}
}
&.important {
@include themify($themes) {
background-color: themed(orangeTextColor);
}
}
&.critical {
@include themify($themes) {
background-color: themed(redTextColor);
}
}
&.time {
@include themify($themes) {
background-color: themed(orangeTextColor);
}
}
}
}

View file

@ -140,6 +140,13 @@ app-history {
tr {
&.locked-transaction {
@include themify($themes) {
color: themed(optionalTextColor);
}
}
&:nth-child(4n+1) {
@include themify($themes) {
@ -185,17 +192,30 @@ app-history {
}
}
.lock-transaction {
@include themify($themes) {
background-color: themed(orangeTextColor);
}
}
.status.send {
.icon {
background-color: #ff5252;
.status-transaction {
@include themify($themes) {
background-color: themed(redTextColor);
}
}
}
.status.received {
.icon {
background-color: #00c853;
.status-transaction {
@include themify($themes) {
background-color: themed(greenTextColor);
}
}
}
}

View file

@ -80,3 +80,13 @@ body {
height: 100%;
}
}
.update-tooltip {
.tooltip-inner {
.icon {
mask: url(assets/icons/update-alert.svg) no-repeat center;
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -70,7 +70,17 @@ namespace nodetool
m_alert_mode(0),
m_maintainers_entry_local(AUTO_VAL_INIT(m_maintainers_entry_local)),
m_maintainers_info_local(AUTO_VAL_INIT(m_maintainers_info_local)),
m_startup_time(time(nullptr))
m_startup_time(time(nullptr)),
m_config{},
m_have_address(false),
m_first_connection_maker_call(false),
m_listenning_port{},
m_external_port{},
m_ip_address{},
m_last_stat_request_time{},
m_use_only_priority_peers(false),
m_peer_livetime{}
{}
static void init_options(boost::program_options::options_description& desc);
@ -188,7 +198,7 @@ namespace nodetool
bool is_peer_used(const peerlist_entry& peer);
bool is_addr_connected(const net_address& peer);
template<class t_callback>
bool try_ping(basic_node_data& node_data, p2p_connection_context& context, t_callback cb);
bool try_ping(basic_node_data& node_data, p2p_connection_context& context, const t_callback& cb);
bool make_expected_connections_count(bool white_list, size_t expected_connections);
void cache_connect_fail_info(const net_address& addr);
bool is_addr_recently_failed(const net_address& addr);

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -190,8 +190,6 @@ namespace nodetool
}
if(command_line::has_arg(vm, arg_p2p_use_only_priority_nodes))
m_use_only_priority_peers = true;
else
m_use_only_priority_peers = false;
if (command_line::has_arg(vm, arg_p2p_seed_node))
@ -275,6 +273,10 @@ namespace nodetool
#ifndef TESTNET
//TODO:
//ADD_HARDCODED_SEED_NODE(std::string("0.0.0.0:") + std::to_string(P2P_DEFAULT_PORT));
ADD_HARDCODED_SEED_NODE("95.217.43.225", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("94.130.137.230", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("95.217.42.247", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("94.130.160.115", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("207.154.237.82", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("207.154.240.198", P2P_DEFAULT_PORT);
ADD_HARDCODED_SEED_NODE("207.154.255.10", P2P_DEFAULT_PORT);
@ -1182,7 +1184,7 @@ namespace nodetool
}
//-----------------------------------------------------------------------------------
template<class t_payload_net_handler> template<class t_callback>
bool node_server<t_payload_net_handler>::try_ping(basic_node_data& node_data, p2p_connection_context& context, t_callback cb)
bool node_server<t_payload_net_handler>::try_ping(basic_node_data& node_data, p2p_connection_context& context, const t_callback& cb)
{
if(!node_data.my_port)
return false;

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -140,7 +140,7 @@ namespace nodetool
friend class boost::serialization::access;
epee::critical_section m_peerlist_lock;
std::string m_config_folder;
bool m_allow_local_ip;
bool m_allow_local_ip = false;
peers_indexed m_peers_gray;

View file

@ -1084,6 +1084,7 @@ namespace currency
uint64_t starter_timestamp;
crypto::hash last_block_hash;
bool is_pos_allowed;
uint64_t iterations_processed;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
@ -1091,6 +1092,7 @@ namespace currency
KV_SERIALIZE(block_timestamp)
KV_SERIALIZE(height)
KV_SERIALIZE(is_pos_allowed)
KV_SERIALIZE(iterations_processed)
KV_SERIALIZE(starter_timestamp)
KV_SERIALIZE_VAL_POD_AS_BLOB(last_block_hash);
END_KV_SERIALIZE_MAP()

View file

@ -1,3 +1,4 @@
// Copyright (c) 2014-2019 The Zano Project
// Copyright (c) 2014-2017 The The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -73,7 +74,7 @@ struct json_archive;
template <>
struct json_archive<true> : public json_archive_base<std::ostream, true>
{
json_archive(stream_type &s, bool indent = false) : base_type(s, indent) { }
json_archive(stream_type &s, bool indent = false) : base_type(s, indent), inner_array_size_{} { }
template<typename T>
static auto promote_to_printable_integer_type(T v) -> decltype(+v)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -21,6 +21,8 @@
#include "version.h"
#include "string_coding.h"
#include <cstdlib>
#if defined(WIN32)
#include <crtdbg.h>
#endif
@ -95,6 +97,7 @@ namespace
#endif
, m_color(std::move(rhs.m_color))
, m_log_level(std::move(rhs.m_log_level))
, m_bright(false)
{
rhs.m_flush = false;
}
@ -108,6 +111,8 @@ namespace
~message_writer()
{
NESTED_TRY_ENTRY();
if (m_flush)
{
m_flush = false;
@ -126,6 +131,8 @@ namespace
}
std::cout << std::endl;
}
NESTED_CATCH_ENTRY(__func__);
}
private:
@ -1408,6 +1415,10 @@ bool simple_wallet::submit_transfer(const std::vector<std::string> &args)
//----------------------------------------------------------------------------------------------------
int main(int argc, char* argv[])
{
try
{
TRY_ENTRY();
#ifdef WIN32
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
@ -1419,8 +1430,6 @@ int main(int argc, char* argv[])
std::fflush(nullptr);
});
//TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
po::options_description desc_general("General options");
@ -1444,7 +1453,7 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, command_line::arg_log_file);
command_line::add_arg(desc_params, command_line::arg_log_level);
tools::wallet_rpc_server::init_options(desc_params);
po::positional_options_description positional_options;
@ -1476,7 +1485,7 @@ int main(int argc, char* argv[])
return true;
});
if (!r)
return 1;
return EXIT_FAILURE;
//set up logging options
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
@ -1498,7 +1507,7 @@ int main(int argc, char* argv[])
LOG_PRINT_L0("Setting log level = " << command_line::get_arg(vm, command_line::arg_log_level));
log_space::get_set_log_detalisation_level(true, command_line::get_arg(vm, command_line::arg_log_level));
}
bool offline_mode = command_line::get_arg(vm, arg_offline_mode);
if(command_line::has_arg(vm, tools::wallet_rpc_server::arg_rpc_bind_port))
@ -1511,19 +1520,19 @@ int main(int argc, char* argv[])
if (!command_line::has_arg(vm, arg_wallet_file) || command_line::get_arg(vm, arg_wallet_file).empty())
{
LOG_ERROR("Wallet file is not set.");
return 1;
return EXIT_FAILURE;
}
if (!command_line::has_arg(vm, arg_daemon_address) && !command_line::has_arg(vm, arg_offline_mode))
{
LOG_ERROR("Daemon address is not set.");
return 1;
return EXIT_FAILURE;
}
if (!command_line::has_arg(vm, arg_password) )
{
LOG_ERROR("Wallet password is not set.");
return 1;
return EXIT_FAILURE;
}
std::string wallet_file = command_line::get_arg(vm, arg_wallet_file);
@ -1554,7 +1563,7 @@ int main(int argc, char* argv[])
catch (const std::exception& e)
{
LOG_ERROR("Wallet initialize failed: " << e.what());
return 1;
return EXIT_FAILURE;
}
break;
}
@ -1566,7 +1575,7 @@ int main(int argc, char* argv[])
LOG_PRINT_L0("Initializing wallet...");
wal.init(daemon_address);
if (command_line::get_arg(vm, arg_generate_new_wallet).size())
return 1;
return EXIT_FAILURE;
if (!offline_mode)
wal.refresh();
LOG_PRINT_GREEN("Loaded ok", LOG_LEVEL_0);
@ -1574,7 +1583,7 @@ int main(int argc, char* argv[])
catch (const std::exception& e)
{
LOG_ERROR("Wallet initialize failed: " << e.what());
return 1;
return EXIT_FAILURE;
}
break;
}
@ -1582,7 +1591,7 @@ int main(int argc, char* argv[])
tools::wallet_rpc_server wrpc(wal);
bool r = wrpc.init(vm);
CHECK_AND_ASSERT_MES(r, 1, "Failed to initialize wallet rpc server");
CHECK_AND_ASSERT_MES(r, EXIT_FAILURE, "Failed to initialize wallet rpc server");
tools::signal_handler::install([&wrpc/*, &wal*/ /* TODO(unassigned): use? */] {
wrpc.send_stop_signal();
@ -1599,16 +1608,16 @@ int main(int argc, char* argv[])
catch (const std::exception& e)
{
LOG_ERROR("Failed to store wallet: " << e.what());
return 1;
return EXIT_FAILURE;
}
}else
{
//runs wallet with console interface
//runs wallet with console interface
sw->set_offline_mode(offline_mode);
r = sw->init(vm);
CHECK_AND_ASSERT_MES(r, 1, "Failed to initialize wallet");
if (command_line::get_arg(vm, arg_generate_new_wallet).size())
return 1;
return EXIT_FAILURE;
std::vector<std::string> command = command_line::get_arg(vm, arg_command);
@ -1628,6 +1637,12 @@ int main(int argc, char* argv[])
sw->deinit();
}
}
return 1;
//CATCH_ENTRY_L0("main", 1);
CATCH_ENTRY_L0(__func__, EXIT_FAILURE);
}
catch (...)
{
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

View file

@ -323,13 +323,17 @@ namespace
~stratum_protocol_handler_config()
{
NESTED_TRY_ENTRY();
LOG_PRINT_L4("stratum_protocol_handler_config::dtor()");
m_stop_flag = true;
m_blocktemplate_update_thread.join();
if (m_p_core)
m_p_core->remove_blockchain_update_listener(this);
NESTED_CATCH_ENTRY(__func__);
}
void add_protocol_handler(protocol_handler_t* p_ph)
@ -797,6 +801,8 @@ namespace
~stratum_protocol_handler()
{
NESTED_TRY_ENTRY();
if (m_connection_initialized)
{
m_config.remove_protocol_handler(this);
@ -804,6 +810,8 @@ namespace
}
LOG_PRINT_CC(m_context, "stratum_protocol_handler::dtor()", LOG_LEVEL_4);
NESTED_CATCH_ENTRY(__func__);
}
// required member for epee::net_utils::boosted_tcp_server concept
@ -1086,6 +1094,7 @@ struct stratum_server_impl
//------------------------------------------------------------------------------------------------------------------------------
stratum_server::stratum_server(core* c)
: m_p_core(c)
, m_threads_count(0)
{
m_impl = new stratum_server_impl();
}

View file

@ -2,6 +2,6 @@
#define BUILD_COMMIT_ID "@VERSION@"
#define PROJECT_VERSION "1.0"
#define PROJECT_VERSION_BUILD_NO 29
#define PROJECT_VERSION_BUILD_NO 31
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2018 Zano Project
// Copyright (c) 2014-2019 Zano Project
// Copyright (c) 2014-2018 The Louisdor Project
// Copyright (c) 2012-2013 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
@ -2216,7 +2216,14 @@ void wallet2::sign_transfer(const std::string& tx_sources_blob, std::string& sig
// calculate key images for each change output
crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);
crypto::generate_key_derivation(m_account.get_keys().m_account_address.m_view_public_key, ft.one_time_key, derivation);
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(
crypto::generate_key_derivation(
m_account.get_keys().m_account_address.m_view_public_key,
ft.one_time_key,
derivation),
"internal error: sign_transfer: failed to generate key derivation("
<< m_account.get_keys().m_account_address.m_view_public_key
<< ", view secret key: " << ft.one_time_key << ")");
for (size_t i = 0; i < ft.tx.vout.size(); ++i)
{

View file

@ -1014,7 +1014,7 @@ namespace tools
cxt.rsp.status = CORE_RPC_STATUS_NOT_FOUND;
uint64_t timstamp_start = runtime_config.get_core_time();
uint64_t timstamp_last_idle_call = runtime_config.get_core_time();
cxt.rsp.iterations_processed = 0;
for (size_t i = 0; i != cxt.sp.pos_entries.size(); i++)
{
@ -1080,6 +1080,7 @@ namespace tools
{
PROFILE_FUNC("check_hash");
check_hash_res = currency::check_hash(kernel_hash, this_coin_diff);
++cxt.rsp.iterations_processed;
}
if (check_hash_res)
{

View file

@ -163,7 +163,7 @@ namespace tools
currency::transaction tx;
std::vector<currency::extra_v> extra;
std::string signed_tx_blob_str;
m_wallet.transfer(dsts, req.mixin, req.unlock_time, req.fee, extra, attachments, detail::ssi_digit, tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, CURRENCY_TO_KEY_OUT_RELAXED, true, 0, true, &signed_tx_blob_str);
m_wallet.transfer(dsts, req.mixin, 0/*req.unlock_time*/, req.fee, extra, attachments, detail::ssi_digit, tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, CURRENCY_TO_KEY_OUT_RELAXED, true, 0, true, &signed_tx_blob_str);
if (m_wallet.is_watch_only())
{
res.tx_unsigned_hex = epee::string_tools::buff_to_hex_nodelimer(signed_tx_blob_str); // watch-only wallets can't sign and relay transactions

View file

@ -214,7 +214,7 @@ namespace wallet_rpc
std::list<trnsfer_destination> destinations;
uint64_t fee;
uint64_t mixin;
uint64_t unlock_time;
//uint64_t unlock_time;
std::string payment_id; // hex-encoded
std::string comment;
@ -222,7 +222,7 @@ namespace wallet_rpc
KV_SERIALIZE(destinations)
KV_SERIALIZE(fee)
KV_SERIALIZE(mixin)
KV_SERIALIZE(unlock_time)
//KV_SERIALIZE(unlock_time)
KV_SERIALIZE(payment_id)
KV_SERIALIZE(comment)
END_KV_SERIALIZE_MAP()

View file

@ -117,7 +117,6 @@ bool wallet_rpc_integrated_address_transfer::c1(currency::core& c, size_t ev_ind
tools::wallet_rpc::COMMAND_RPC_TRANSFER::request req = AUTO_VAL_INIT(req);
req.fee = TESTS_DEFAULT_FEE;
req.mixin = 0;
req.unlock_time = 0;
tools::wallet_rpc::trnsfer_destination tds = AUTO_VAL_INIT(tds);
tds.address = alice_integrated_address;
tds.amount = MK_TEST_COINS(3);

52
utils/gpg/zoidberg.asc Normal file
View file

@ -0,0 +1,52 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFzaLu8BEADJY4nZ0+9/PnxGIPLQUcWVQtVLMlqpcYVFR1dgLeBWYs5mT13h
usJMxz10VEuEK2MfhcnlR7oZCDiHRJUbf1ixNIOUDLyzmLqNIcddDZ0H4i7XfEUW
SpJx1hKSoQhrSkf/wO/nIZRDIhyHncTbZgnWew0tz5qnvSvScXsWvljmDLegcC0+
El1fT6DdFWKsgXRPFk65EEfVQsCRYIV3jvDkdUaqEGqJqC2/YapWAnEivomkuTe2
TZSj0N1bqHG39q0T/8Shn4EFdGdFi8AsbNc9WJqXeBh0GMi1KpNdB+5k1kL+c7xy
w9/vPZx6ZepEYxynm6Q4Hk0Y+uDc+tqRNnclKp2/GLJba7S56Pgmo5jP+jy21GKe
JmResJie1lO0zolBMBna6PO2G7fscCGjAVYAeLrvRnGiaJIcqNhYDPF1+yUz3kzI
XYwwzp3AVik01IbwTu4qo4KG/VsWqgjvpfGODEybW7ejSouWun/y0F5jjpyjN1eO
z6UrMJalMOajQ4pSogz+bYLbN5hldNpW4yEBlysep57cWaB/u9bEjwYwtS3ygeOD
s9gHeB0/UndFSlbGsRsdWG+RWSkdBldwh3NEGOzX14Kwxr0N2prhPOrRZzwwHyI8
77zxGmR0I0A7Yfa225IVKJt5BKZgktMFWefHMoHTdGwZsoTa+XWVSTexAwARAQAB
tCpjcnlwdG96b2lkYmVyZyA8Y3J5cHRvLnpvaWRiZXJnQGdtYWlsLmNvbT6JAk4E
EwEIADgWIQRa2A4uFtR26ClvPswi3rl6VMb97AUCXNou7wIbAwULCQgHAgYVCgkI
CwIEFgIDAQIeAQIXgAAKCRAi3rl6VMb97BLdD/9aU6uX29NhnRVv1Uk+b7YweV2M
IMge27u0KCMAxzzfrOw5hQ5OvPLrtk6L/w6bk587XkLh4kAb6wKPpS1/rXmu7c6W
4IfoXKkeOOWRfCGodtACk1uVbz/UwZyCosyJQB6pz7MToAvp8Lki93my65FLkyqT
p7eSjJEEJcQ1WG9UOF8R1TuxuNbqQZHNamiIExhBHZAvtGG4CVkitTFC9JzrdFqP
RKiMxP1iucoSlD/8cEjYQAro08AJXV0vvNPOZmH5iv918J/u2DvXn5T83gWZqkIC
7zHg6WCTDVDMJ1n6l6m4EsAw3ku38XUnvFVKNA1biKRNIMyeZE+mnSGd00bllCPw
aUlX7WbBiNY5uH+4x7T3EZwMhIpvpUGfjRqaerjdd4Ywx4b4KNj1rbQf8MJuVf4K
iKmSPOS4T6T9sBhLCopoB2Uj14x0UWa7fHcQmAcvWJCDi/NLldhKdP6lw3LGSPm/
j6po8oeORU8vB1/6Sk3MUEkvITUSzKIA4ndUc+O4DMqJfJN98nBLmAJMPm9eupys
S5VIeFj9QIedsC38Pc7rG0mVkmhBF2xTAyEIJEDJLdKSX0Za2wVefhpRzEmyc4ku
C3NefZRA7DX5gzn7bW/EB7SsLHsQocIuXgNdtUbomPYZ6fkFUO/oPtCGOMPPov2p
GN94gAwpAAqe0TAzerkCDQRc2i7vARAAmD48zNNniY0B7wxDZy3sZ3HX+JO6KGS3
Krri2180HnDpj+FVFJW5y+eWJuVDh6omZ9VCks3w1DnxMTD5Sv0JEnnapBE/EZNn
Uo8YHZZ0ZSk7TK0HUklBaC1Wvg34AdUwKk49Aq2jGcwVTJKklXQV7uGr1jwmzGxj
VkLc8ZECfqR7Fa5m6+QhpurvMLeXeY0PkKjFVVFkMCLPhI22RoBgc/9Z4rvIWx0x
u65E4Z1cXWo1YQJduCXRUmfY9kCjwZvAmPh6nOQitr3bz1/jNNQdL5P7P7bzDcBE
/QGjEwP7R7fovwBM5bGSFa8BpfWyos4rcXVPvE0snpC+lDIgmi7/JlyxrWjgofPx
NB4I9hEnWfWyMs9wO/YQNxUpHKiFlbTFowS4AUqQKhsyTPFIfPucBYaxohJJGFWK
JoUba09XUg7H4jJsjFXjkMfAcoaAFzIO0ugQK+eIdmVLUZK7DZHvw9JN6SkVqCnW
PphgDSwFOi79rolNk0telGcL7A2LwOAgkaSjeNt2wqq7s4fZpghtGbLwnWGHNAeY
jy+kR+Id7/pw2P9TC/hQ+ZKN1ciBm7T/9NXqbLkyRWQ4bAAHUryzf7z2Z+tWjJ2n
kEJRklyl7rLaxEu8yVaxWFQu7k8xNxhm9wIPd4a0jl4ioCrV6toKQzAgUhJ4LAMu
Jf3bZzzd43sAEQEAAYkCNgQYAQgAIBYhBFrYDi4W1HboKW8+zCLeuXpUxv3sBQJc
2i7vAhsMAAoJECLeuXpUxv3s1nQQAI4Q4aRX02lV9DpLvMeNsMB0JDS3bS3I2cz6
ti3EES0zAWWamNUlDAPaSIjcxBw5USmCpW7UhXNhyZ/xZAf4NfeemYaGbLTiPdVU
1YoVU6RjriQzrMSYVfuOLiBPwj1eQRnQMqYhg1acbtjEOFNyGxEvDCxn58OPCccC
KMVEhYI74UcAJ0jGdLKjWMJIgye+Mg3asgE2daWJig0YfXvbC2zX/5DAAZ0H+ydI
IZ1gj5Nirson+TDjJiK75YfGKFPIRVLbe+GdttvHfxmXnYscPXnoOhjjANxgJn9m
JXaip8IIlvF+/rXQ0ifIvB4pyzMsateRvblrmd2LjXChgl0pB3tWP5w46XNRNLlx
ETRt4cnkeHPOLXPE+Jzs/FwZx/BAGP7mkMi7tnGwnCZZKR5g1xQxII8Zj4fX9kgt
1pL9buKDsntx+B5byIFZcAT9xT4OzdCwvNEGjoZx8AK8ucRAbjmdKWK3gxWLNHph
PBeiO3hGskOBfSHVrNJdWFH2PflbebWqttF+QQgNS+3t0XBcwp04j4AJTw/3oKK+
kFsTUpJAuriDcbcfnCEmDR4NAmDSoVGaj+U6gf+/t5/j6AKvDULpAsKWEOm/LDIV
Pi/3CQEwOeY7zKkULSmjJdZacxAWLOINKySkQhYHPAJQkiLBHXtkP91glLnw7UZs
0588HZ6Q
=Esla
-----END PGP PUBLIC KEY BLOCK-----