From c2f45ab000eaf9f4f11c7e7f0c144617adb9d503 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 00:19:05 +0200 Subject: [PATCH 01/16] disabled target cache --- src/currency_core/blockchain_storage.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 1b111ae3..7e1f8506 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -58,7 +58,7 @@ using namespace currency; #define BLOCKCHAIN_STORAGE_OPTIONS_ID_CURRENT_BLOCK_CUMUL_SZ_LIMIT 0 #define BLOCKCHAIN_STORAGE_OPTIONS_ID_CURRENT_PRUNED_RS_HEIGHT 1 #define BLOCKCHAIN_STORAGE_OPTIONS_ID_LAST_WORKED_VERSION 2 -#define BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MAJOR_COMPATIBILITY_VERSION 3 //mismatch here means full resync +#define BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MAJOR_COMPATIBILITY_VERSION 4 //mismatch here means full resync #define BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MINOR_COMPATIBILITY_VERSION 4 //mismatch here means some reinitializations #define TARGETDATA_CACHE_SIZE DIFFICULTY_WINDOW + 10 @@ -903,8 +903,8 @@ wide_difficulty_type blockchain_storage::get_next_diff_conditional(bool pos) con //skip genesis timestamp TIME_MEASURE_START_PD(target_calculating_enum_blocks); std::list>& targetdata_cache = pos ? m_pos_targetdata_cache : m_pow_targetdata_cache; - if (targetdata_cache.empty()) - load_targetdata_cache(pos); + //if (targetdata_cache.empty()) + load_targetdata_cache(pos); size_t count = 0; for (auto it = targetdata_cache.rbegin(); it != targetdata_cache.rend() && count < DIFFICULTY_WINDOW; it++) @@ -4259,7 +4259,11 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt return false; } - get_block_height(bl); + uint64_t h = get_block_height(bl); + if (h == 221) + { + LOG_PRINT_L0("dddd"); + } if(!check_block_timestamp_main(bl)) { @@ -4293,6 +4297,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt //check proof of work TIME_MEASURE_START_PD(target_calculating_time_2); wide_difficulty_type current_diffic = get_next_diff_conditional(is_pos_bl); + LOG_PRINT_L0("Difficulty: " << current_diffic); CHECK_AND_ASSERT_MES_CUSTOM(current_diffic, false, bvc.m_verification_failed = true, "!!!!!!!!! difficulty overhead !!!!!!!!!"); TIME_MEASURE_FINISH_PD(target_calculating_time_2); From 3482a82c2eb63296c59d8e1587d299b76b3d2b4c Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 May 2019 01:19:48 +0300 Subject: [PATCH 02/16] === build number: 25 -> 26 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index 205690a7..b6cdb902 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -2,6 +2,6 @@ #define BUILD_COMMIT_ID "@VERSION@" #define PROJECT_VERSION "1.0" -#define PROJECT_VERSION_BUILD_NO 25 +#define PROJECT_VERSION_BUILD_NO 26 #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 "]" From 31f3a89aeb54098eedfb2193266080919860ef34 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 00:35:47 +0200 Subject: [PATCH 03/16] removed ugly debug code --- src/currency_core/blockchain_storage.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 7e1f8506..eee30813 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -4259,12 +4259,6 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt return false; } - uint64_t h = get_block_height(bl); - if (h == 221) - { - LOG_PRINT_L0("dddd"); - } - if(!check_block_timestamp_main(bl)) { LOG_PRINT_L0("Block with id: " << id << ENDL @@ -4297,7 +4291,6 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt //check proof of work TIME_MEASURE_START_PD(target_calculating_time_2); wide_difficulty_type current_diffic = get_next_diff_conditional(is_pos_bl); - LOG_PRINT_L0("Difficulty: " << current_diffic); CHECK_AND_ASSERT_MES_CUSTOM(current_diffic, false, bvc.m_verification_failed = true, "!!!!!!!!! difficulty overhead !!!!!!!!!"); TIME_MEASURE_FINISH_PD(target_calculating_time_2); From 0674ea51feb44dff5f737c585d132cc00c57fca2 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 01:52:48 +0200 Subject: [PATCH 04/16] fixed alerts and fixed resync after daemon restart --- src/connectivity_tool/conn_tool.cpp | 1 + src/currency_core/blockchain_storage.cpp | 2 +- src/currency_core/currency_config.h | 2 +- src/p2p/net_node.inl | 12 ++++++------ utils/update_alert.json | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/connectivity_tool/conn_tool.cpp b/src/connectivity_tool/conn_tool.cpp index ac0586c6..98f2a53f 100644 --- a/src/connectivity_tool/conn_tool.cpp +++ b/src/connectivity_tool/conn_tool.cpp @@ -793,6 +793,7 @@ bool handle_increment_build_no(po::variables_map& vm) //--------------------------------------------------------------------------------------------------------------- bool handle_update_maintainers_info(po::variables_map& vm) { + log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL); if(!command_line::has_arg(vm, arg_rpc_port)) { std::cout << "ERROR: rpc port not set" << ENDL; diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index eee30813..7c99693a 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -58,7 +58,7 @@ using namespace currency; #define BLOCKCHAIN_STORAGE_OPTIONS_ID_CURRENT_BLOCK_CUMUL_SZ_LIMIT 0 #define BLOCKCHAIN_STORAGE_OPTIONS_ID_CURRENT_PRUNED_RS_HEIGHT 1 #define BLOCKCHAIN_STORAGE_OPTIONS_ID_LAST_WORKED_VERSION 2 -#define BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MAJOR_COMPATIBILITY_VERSION 4 //mismatch here means full resync +#define BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MAJOR_COMPATIBILITY_VERSION 3 //mismatch here means full resync #define BLOCKCHAIN_STORAGE_OPTIONS_ID_STORAGE_MINOR_COMPATIBILITY_VERSION 4 //mismatch here means some reinitializations #define TARGETDATA_CACHE_SIZE DIFFICULTY_WINDOW + 10 diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index a5488380..c406309c 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -205,7 +205,7 @@ #define CURRENT_TRANSACTION_CHAIN_ENTRY_ARCHIVE_VER 3 #define CURRENT_BLOCK_EXTENDED_INFO_ARCHIVE_VER 1 -#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 4 +#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 5 #define BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION 1 diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index c7e18dac..2d3a9fc4 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -402,14 +402,14 @@ namespace nodetool template bool node_server::on_maintainers_entry_update() { - LOG_PRINT_MAGENTA("Fresh maintainers info recieved(timestamp: " << m_maintainers_info_local.timestamp << ")", LOG_LEVEL_0); + LOG_PRINT_CHANNEL_COLOR2(NULL, NULL, "Fresh maintainers info recieved(timestamp: " << m_maintainers_info_local.timestamp << ")", LOG_LEVEL_0, epee::log_space::console_color_magenta); if(PROJECT_VERSION_BUILD_NO < m_maintainers_info_local.build_no) { - LOG_PRINT_MAGENTA("Newer version avaliable: " << static_cast(m_maintainers_info_local.ver_major) << + LOG_PRINT_CHANNEL_COLOR2(NULL, NULL, "Newer version avaliable: " << static_cast(m_maintainers_info_local.ver_major) << "." << static_cast(m_maintainers_info_local.ver_minor) << "." << static_cast(m_maintainers_info_local.ver_revision) << "." << static_cast(m_maintainers_info_local.build_no) << - ", current version: " << PROJECT_VERSION_LONG, LOG_LEVEL_0); + ", current version: " << PROJECT_VERSION_LONG, LOG_LEVEL_0, epee::log_space::console_color_magenta); } handle_alert_conditions(); @@ -893,7 +893,7 @@ namespace nodetool if(m_alert_mode != ALERT_TYPE_CALM) return true; - LOG_PRINT_L0("This software is old, please update."); + LOG_PRINT_CHANNEL2(NULL, NULL, "This software is outdated, please update.", LOG_LEVEL_0); return true; } //----------------------------------------------------------------------------------- @@ -903,7 +903,7 @@ namespace nodetool if(m_alert_mode != ALERT_TYPE_URGENT) return true; - LOG_PRINT_CYAN("[URGENT]:This software is old, please update.", LOG_LEVEL_0); + LOG_PRINT_CHANNEL_COLOR2(NULL, NULL, "[URGENT]:This software is dramatically outdated, please update to latest version.", LOG_LEVEL_0, epee::log_space::console_color_cyan); return true; } //----------------------------------------------------------------------------------- @@ -913,7 +913,7 @@ namespace nodetool if(m_alert_mode != ALERT_TYPE_CRITICAL) return true; - LOG_PRINT_RED("[CRITICAL]:This software is old, please update.", LOG_LEVEL_0); + LOG_PRINT_CHANNEL_COLOR2(NULL, NULL, "[CRITICAL]:This software is critically outdated, please update to latest version.", LOG_LEVEL_0, epee::log_space::console_color_red); return true; } //----------------------------------------------------------------------------------- diff --git a/utils/update_alert.json b/utils/update_alert.json index 57641f30..da45cb11 100644 --- a/utils/update_alert.json +++ b/utils/update_alert.json @@ -2,10 +2,10 @@ "maj":1, "min":0, "rev":0, - "build":8, + "build":26, "cs":[ { - "build":7, + "build":26, "mode":3 } ] From 52dc0b498d546f19aa576f04607053960d23bf79 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 May 2019 02:53:33 +0300 Subject: [PATCH 05/16] === build number: 26 -> 27 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index b6cdb902..d3892eae 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -2,6 +2,6 @@ #define BUILD_COMMIT_ID "@VERSION@" #define PROJECT_VERSION "1.0" -#define PROJECT_VERSION_BUILD_NO 26 +#define PROJECT_VERSION_BUILD_NO 27 #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 "]" From d5f5db199d8d4d12221fb1d19e6b840ff06f6073 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 12:35:20 +0200 Subject: [PATCH 06/16] updated alerts json --- utils/update_alert.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/update_alert.json b/utils/update_alert.json index da45cb11..572decfd 100644 --- a/utils/update_alert.json +++ b/utils/update_alert.json @@ -5,7 +5,7 @@ "build":26, "cs":[ { - "build":26, + "build":27, "mode":3 } ] From 53c1a456651ce2571cc6fcb842f7ab8ce6714931 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 12:37:17 +0200 Subject: [PATCH 07/16] disabled cache for db --- src/common/db_abstract_accessor.h | 4 ++-- src/currency_core/currency_config.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/db_abstract_accessor.h b/src/common/db_abstract_accessor.h index 61126293..4568c3bc 100644 --- a/src/common/db_abstract_accessor.h +++ b/src/common/db_abstract_accessor.h @@ -695,8 +695,8 @@ namespace tools typedef basic_key_value_accessor base_class; - typedef epee::misc_utils::cache_with_write_isolation, 10000> cache_container_type; - //typedef epee::misc_utils::cache_dummy, 100000> cache_container_type; + //typedef epee::misc_utils::cache_with_write_isolation, 10000> cache_container_type; + typedef epee::misc_utils::cache_dummy, 100000> cache_container_type; mutable cache_container_type m_cache; diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index c406309c..35b9cdca 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -205,7 +205,7 @@ #define CURRENT_TRANSACTION_CHAIN_ENTRY_ARCHIVE_VER 3 #define CURRENT_BLOCK_EXTENDED_INFO_ARCHIVE_VER 1 -#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 5 +#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 6 #define BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION 1 From 7c5b7b8bcbeeaabbf05d96b959d1ea239e344203 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 13:43:04 +0200 Subject: [PATCH 08/16] fixed bug with cache sync --- src/currency_core/blockchain_storage.cpp | 5 +++++ src/currency_core/blockchain_storage.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 7c99693a..3db594ca 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -902,6 +902,7 @@ wide_difficulty_type blockchain_storage::get_next_diff_conditional(bool pos) con return DIFFICULTY_STARTER; //skip genesis timestamp TIME_MEASURE_START_PD(target_calculating_enum_blocks); + CRITICAL_REGION_BEGIN(m_targetdata_cache_lock); std::list>& targetdata_cache = pos ? m_pos_targetdata_cache : m_pow_targetdata_cache; //if (targetdata_cache.empty()) load_targetdata_cache(pos); @@ -913,6 +914,7 @@ wide_difficulty_type blockchain_storage::get_next_diff_conditional(bool pos) con commulative_difficulties.push_back(it->first); ++count; } + CRITICAL_REGION_END(); wide_difficulty_type& dif = pos ? m_cached_next_pos_difficulty : m_cached_next_pow_difficulty; TIME_MEASURE_FINISH_PD(target_calculating_enum_blocks); @@ -4594,6 +4596,7 @@ void blockchain_storage::on_block_removed(const block_extended_info& bei) //------------------------------------------------------------------ void blockchain_storage::update_targetdata_cache_on_block_added(const block_extended_info& bei) { + CRITICAL_REGION_LOCAL(m_targetdata_cache_lock); if (bei.height == 0) return; //skip genesis std::list>& targetdata_cache = is_pos_block(bei.bl) ? m_pos_targetdata_cache : m_pow_targetdata_cache; @@ -4604,6 +4607,7 @@ void blockchain_storage::update_targetdata_cache_on_block_added(const block_exte //------------------------------------------------------------------ void blockchain_storage::update_targetdata_cache_on_block_removed(const block_extended_info& bei) { + CRITICAL_REGION_LOCAL(m_targetdata_cache_lock); std::list>& targetdata_cache = is_pos_block(bei.bl) ? m_pos_targetdata_cache : m_pow_targetdata_cache; if (targetdata_cache.size()) targetdata_cache.pop_back(); @@ -4613,6 +4617,7 @@ void blockchain_storage::update_targetdata_cache_on_block_removed(const block_ex //------------------------------------------------------------------ void blockchain_storage::load_targetdata_cache(bool is_pos)const { + CRITICAL_REGION_LOCAL(m_targetdata_cache_lock); std::list>& targetdata_cache = is_pos? m_pos_targetdata_cache: m_pow_targetdata_cache; targetdata_cache.clear(); uint64_t stop_ind = 0; diff --git a/src/currency_core/blockchain_storage.h b/src/currency_core/blockchain_storage.h index eaa12740..580afe81 100644 --- a/src/currency_core/blockchain_storage.h +++ b/src/currency_core/blockchain_storage.h @@ -511,6 +511,7 @@ namespace currency mutable wide_difficulty_type m_cached_next_pow_difficulty; mutable wide_difficulty_type m_cached_next_pos_difficulty; + mutable critical_section m_targetdata_cache_lock; mutable std::list > m_pos_targetdata_cache; mutable std::list > m_pow_targetdata_cache; //work like a cache to avoid recalculation on read operations From cdbe023198bbbc28b6fdfbb6425db0dcc01a133b Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 13:44:14 +0200 Subject: [PATCH 09/16] dropped blockchain in case it broken --- src/currency_core/currency_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index 35b9cdca..2e4e9303 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -205,7 +205,7 @@ #define CURRENT_TRANSACTION_CHAIN_ENTRY_ARCHIVE_VER 3 #define CURRENT_BLOCK_EXTENDED_INFO_ARCHIVE_VER 1 -#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 6 +#define BLOCKCHAIN_STORAGE_MAJOR_COMPATIBILITY_VERSION CURRENCY_FORMATION_VERSION + 7 #define BLOCKCHAIN_STORAGE_MINOR_COMPATIBILITY_VERSION 1 From c1d15aeabed6665ecc0a3495b7d6b1eec71e440b Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 14:27:28 +0200 Subject: [PATCH 10/16] enabled db cache --- src/common/db_abstract_accessor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/db_abstract_accessor.h b/src/common/db_abstract_accessor.h index 4568c3bc..61126293 100644 --- a/src/common/db_abstract_accessor.h +++ b/src/common/db_abstract_accessor.h @@ -695,8 +695,8 @@ namespace tools typedef basic_key_value_accessor base_class; - //typedef epee::misc_utils::cache_with_write_isolation, 10000> cache_container_type; - typedef epee::misc_utils::cache_dummy, 100000> cache_container_type; + typedef epee::misc_utils::cache_with_write_isolation, 10000> cache_container_type; + //typedef epee::misc_utils::cache_dummy, 100000> cache_container_type; mutable cache_container_type m_cache; From fce3e24d4790fb6f224b5a1b211d3f1ba5b2149e Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 May 2019 15:28:14 +0300 Subject: [PATCH 11/16] === build number: 27 -> 28 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index d3892eae..8522d942 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -2,6 +2,6 @@ #define BUILD_COMMIT_ID "@VERSION@" #define PROJECT_VERSION "1.0" -#define PROJECT_VERSION_BUILD_NO 27 +#define PROJECT_VERSION_BUILD_NO 28 #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 "]" From 929e7e6521c451e3a1a70645bcca18aa7dc56062 Mon Sep 17 00:00:00 2001 From: sowle Date: Thu, 9 May 2019 17:14:39 +0200 Subject: [PATCH 12/16] munin: minor fix for sequence factor graph --- .../{sequense_factor => sequence_factor} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename utils/munin_plugins/{sequense_factor => sequence_factor} (53%) mode change 100755 => 100644 diff --git a/utils/munin_plugins/sequense_factor b/utils/munin_plugins/sequence_factor old mode 100755 new mode 100644 similarity index 53% rename from utils/munin_plugins/sequense_factor rename to utils/munin_plugins/sequence_factor index 0db780ed..561f6ab9 --- a/utils/munin_plugins/sequense_factor +++ b/utils/munin_plugins/sequence_factor @@ -3,16 +3,16 @@ case $1 in config) cat <<'EOM' -graph_title sequense -graph_vlabel sequense +graph_title sequence +graph_vlabel sequence graph_category daemon -pos_sequense_factor.label pos_sequense_factor -pow_sequense_factor.label pow_sequense_factor +pos_sequence_factor.label pos_sequence_factor +pow_sequence_factor.label pow_sequence_factor EOM exit 0;; esac -printf "pos_sequense_factor.value " -connectivity_tool --ip=127.0.0.1 --rpc-port=$ZANO_RPC_PORT --timeout=1000 --rpc-get-daemon-info --getinfo-flags-hex="0x0000000000002000" | grep pos_sequense_factor | cut -d ' ' -f2 -printf "pow_sequense_factor.value " -connectivity_tool --ip=127.0.0.1 --rpc-port=$ZANO_RPC_PORT --timeout=1000 --rpc-get-daemon-info --getinfo-flags-hex="0x0000000000004000" | grep pow_sequense_factor | cut -d ' ' -f2 +printf "pos_sequence_factor.value " +connectivity_tool --ip=127.0.0.1 --rpc-port=$ZANO_RPC_PORT --timeout=1000 --rpc-get-daemon-info --getinfo-flags-hex="0x0000000000002000" | grep pos_sequence_factor | cut -d ' ' -f2 +printf "pow_sequence_factor.value " +connectivity_tool --ip=127.0.0.1 --rpc-port=$ZANO_RPC_PORT --timeout=1000 --rpc-get-daemon-info --getinfo-flags-hex="0x0000000000004000" | grep pow_sequence_factor | cut -d ' ' -f2 From 67e900ec158f945b5bf6f97d81d217442eb0d346 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Thu, 9 May 2019 21:37:16 +0200 Subject: [PATCH 13/16] added extra check for unlock time --- src/wallet/wallet_rpc_server.cpp | 15 +++++++++++++++ src/wallet/wallet_rpc_server_commans_defs.h | 4 ++++ utils/update_alert.json | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index debe1300..ede30932 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -226,6 +226,13 @@ namespace tools m_wallet.get_payments(payment_id, payment_list); for (auto payment : payment_list) { + if (payment.m_unlock_time && !req.allow_locked_transactions) + { + //check that transaction don't have locking for time longer then 10 blocks ahead + //TODO: add code for "unlock_time" set as timestamp, now it's all being filtered + if (payment.m_unlock_time > payment.m_block_height + WALLET_DEFAULT_TX_SPENDABLE_AGE) + continue; + } wallet_rpc::payment_details rpc_payment; rpc_payment.payment_id = req.payment_id; rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.m_tx_hash); @@ -257,6 +264,14 @@ namespace tools for (auto & payment : payment_list) { + if (payment.m_unlock_time && !req.allow_locked_transactions) + { + //check that transaction don't have locking for time longer then 10 blocks ahead + //TODO: add code for "unlock_time" set as timestamp, now it's all being filtered + if (payment.m_unlock_time > payment.m_block_height + WALLET_DEFAULT_TX_SPENDABLE_AGE) + continue; + } + wallet_rpc::payment_details rpc_payment; rpc_payment.payment_id = payment_id_str; rpc_payment.tx_hash = epee::string_tools::pod_to_hex(payment.m_tx_hash); diff --git a/src/wallet/wallet_rpc_server_commans_defs.h b/src/wallet/wallet_rpc_server_commans_defs.h index 2c4ef2ba..79beae2c 100644 --- a/src/wallet/wallet_rpc_server_commans_defs.h +++ b/src/wallet/wallet_rpc_server_commans_defs.h @@ -277,9 +277,11 @@ namespace wallet_rpc struct request { std::string payment_id; // hex-encoded + bool allow_locked_transactions; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(payment_id) + KV_SERIALIZE(allow_locked_transactions) END_KV_SERIALIZE_MAP() }; @@ -299,10 +301,12 @@ namespace wallet_rpc { std::vector payment_ids; uint64_t min_block_height; + bool allow_locked_transactions; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(payment_ids) KV_SERIALIZE(min_block_height) + KV_SERIALIZE(allow_locked_transactions) END_KV_SERIALIZE_MAP() }; diff --git a/utils/update_alert.json b/utils/update_alert.json index 572decfd..6766e765 100644 --- a/utils/update_alert.json +++ b/utils/update_alert.json @@ -5,7 +5,7 @@ "build":26, "cs":[ { - "build":27, + "build":28, "mode":3 } ] From e8e6c83fa8a56cd7bc76a79207d8850c53743f2a Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Fri, 10 May 2019 21:48:29 +0200 Subject: [PATCH 14/16] attempt to fix broken PoS relay --- src/currency_protocol/currency_protocol_handler.inl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/currency_protocol/currency_protocol_handler.inl b/src/currency_protocol/currency_protocol_handler.inl index b281e5c3..60c4bcf3 100644 --- a/src/currency_protocol/currency_protocol_handler.inl +++ b/src/currency_protocol/currency_protocol_handler.inl @@ -258,6 +258,11 @@ namespace currency } //pre-validate block here, and propagate it to network asap to avoid latency of handling big block (tx flood) + //######################################################## + /* + problem with prevalidation: in case of pre_validate_block() is passed but handle_incoming_tx() is failed + network got spammed with notifications about this broken block and then connections got closed. + temporary disabled to more investigation bool prevalidate_relayed = false; if (m_core.pre_validate_block(b, bvc, block_id) && bvc.m_added_to_main_chain) { @@ -266,6 +271,8 @@ namespace currency relay_block(arg, context); prevalidate_relayed = true; } + */ + //######################################################## //now actually process block for(auto tx_blob_it = arg.b.txs.begin(); tx_blob_it!=arg.b.txs.end();tx_blob_it++) @@ -297,7 +304,7 @@ namespace currency if (bvc.m_added_to_main_chain || (bvc.added_to_altchain && bvc.height_difference < 2)) { - if (!prevalidate_relayed) + if (true/*!prevalidate_relayed*/) { // pre-validation failed prevoiusly, but complete check was success, not an alternative block ++arg.hop; From 22ba650e4f044540bce0877433fd5d5ffbcff0a9 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Fri, 10 May 2019 21:55:55 +0200 Subject: [PATCH 15/16] prevalidate_relayed removed from log --- src/currency_protocol/currency_protocol_handler.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/currency_protocol/currency_protocol_handler.inl b/src/currency_protocol/currency_protocol_handler.inl index 60c4bcf3..e4eebf74 100644 --- a/src/currency_protocol/currency_protocol_handler.inl +++ b/src/currency_protocol/currency_protocol_handler.inl @@ -298,7 +298,7 @@ namespace currency } LOG_PRINT_GREEN("[HANDLE]NOTIFY_NEW_BLOCK EXTRA: id: " << block_id << ",bvc.m_added_to_main_chain " << bvc.m_added_to_main_chain - << ",prevalidate_result " << prevalidate_relayed + //<< ",prevalidate_result " << prevalidate_relayed << ",bvc.added_to_altchain " << bvc.added_to_altchain << ",bvc.m_marked_as_orphaned " << bvc.m_marked_as_orphaned, LOG_LEVEL_2); From eebda00e2791cb286b36dcfce1b35630c4571946 Mon Sep 17 00:00:00 2001 From: sowle Date: Sat, 11 May 2019 00:28:58 +0300 Subject: [PATCH 16/16] === build number: 28 -> 29 === --- src/version.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h.in b/src/version.h.in index 8522d942..e523598c 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -2,6 +2,6 @@ #define BUILD_COMMIT_ID "@VERSION@" #define PROJECT_VERSION "1.0" -#define PROJECT_VERSION_BUILD_NO 28 +#define PROJECT_VERSION_BUILD_NO 29 #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 "]"