From 17cd68f86505987e3f27a59fe67728e7042b869f Mon Sep 17 00:00:00 2001 From: stoffu Date: Thu, 18 Oct 2018 08:01:56 +0900 Subject: [PATCH 1/5] tx_pool: revert #4592 and move bin2hex conversion to on_get_transaction_pool --- src/cryptonote_core/tx_pool.cpp | 2 +- src/rpc/core_rpc_server.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 044a66953..3be08b327 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -746,7 +746,7 @@ namespace cryptonote m_blockchain.for_all_txpool_txes([&tx_infos, key_image_infos, include_sensitive_data](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata *bd){ tx_info txi; txi.id_hash = epee::string_tools::pod_to_hex(txid); - txi.tx_blob = epee::string_tools::buff_to_hex_nodelimer(*bd); + txi.tx_blob = *bd; transaction tx; if (!parse_and_validate_tx_from_blob(*bd, tx)) { diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 8617c7e28..635caeb16 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -998,6 +998,8 @@ namespace cryptonote return r; m_core.get_pool_transactions_and_spent_keys_info(res.transactions, res.spent_key_images, !request_has_rpc_origin || !m_restricted); + for (tx_info& txi : res.transactions) + txi.tx_blob = epee::string_tools::buff_to_hex_nodelimer(txi.tx_blob); res.status = CORE_RPC_STATUS_OK; return true; } -- 2.25.1 From d2554341b1e834974bf99283dd00ebe6d0b72980 Mon Sep 17 00:00:00 2001 From: wowario Date: Wed, 24 Oct 2018 13:03:02 +0300 Subject: [PATCH 2/5] difficulty: remove testnet variables --- src/cryptonote_basic/difficulty.cpp | 11 ++--------- src/cryptonote_config.h | 3 --- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index 5ec281d35..796bd5a7f 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -256,14 +256,10 @@ namespace cryptonote { assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= static_cast(N+1) ); - if ( cryptonote::MAINNET && height <= DIFFICULTY_HEIGHT ){ + if ( height <= DIFFICULTY_HEIGHT ){ return static_cast(DIFFICULTY_GUESS); } - if ( cryptonote::TESTNET && height <= DIFFICULTY_TESTNET_HEIGHT ){ - return static_cast(DIFFICULTY_TESTNET_GUESS); - } - for ( int64_t i = 1; i <= N; i++ ) { ST = static_cast(timestamps[i]) - static_cast(timestamps[i-1]); ST = std::max(-4*T, std::min(ST, 6*T)); @@ -281,12 +277,9 @@ namespace cryptonote { next_D = std::max(next_D,(prev_D*108)/100); } - if ( cryptonote::MAINNET && next_D < DIFFICULTY_MINIMUM ) { + if ( next_D < DIFFICULTY_MINIMUM ) { return static_cast(DIFFICULTY_MINIMUM); } - else if ( cryptonote::TESTNET && next_D < DIFFICULTY_TESTNET_MINIMUM ) { - return static_cast(DIFFICULTY_TESTNET_MINIMUM); - } else { return static_cast(next_D); } diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 82408aab3..9d611b43d 100755 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -84,9 +84,6 @@ #define DIFFICULTY_HEIGHT 53666 // v9 fork height #define DIFFICULTY_GUESS 40000000 // difficulty at fork 40m #define DIFFICULTY_MINIMUM 25000000 // minimum difficulty set to 25m -#define DIFFICULTY_TESTNET_HEIGHT 100 -#define DIFFICULTY_TESTNET_GUESS 5069 -#define DIFFICULTY_TESTNET_MINIMUM 4069 #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS -- 2.25.1 From f165101429620bfb70f95af011ed0810691f26c4 Mon Sep 17 00:00:00 2001 From: wowario Date: Wed, 24 Oct 2018 14:37:54 +0300 Subject: [PATCH 3/5] rpc wallet: revert integrated address generation --- src/wallet/wallet2.cpp | 6 ++ src/wallet/wallet2.h | 1 + src/wallet/wallet_rpc_server.cpp | 63 ++++++++++++++++++++ src/wallet/wallet_rpc_server.h | 4 ++ src/wallet/wallet_rpc_server_commands_defs.h | 47 +++++++++++++++ 5 files changed, 121 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 2c741c2e5..635f1bb41 100755 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -906,6 +906,12 @@ std::string wallet2::get_subaddress_as_str(const cryptonote::subaddress_index& i cryptonote::account_public_address address = get_subaddress(index); return cryptonote::get_account_address_as_str(m_nettype, !index.is_zero(), address); } + +//---------------------------------------------------------------------------------------------------- +std::string wallet2::get_integrated_address_as_str(const crypto::hash8& payment_id) const +{ + return cryptonote::get_account_integrated_address_as_str(m_nettype, get_address(), payment_id); +} //---------------------------------------------------------------------------------------------------- void wallet2::add_subaddress_account(const std::string& label) { diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 8e79779a2..ed02d7a28 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -629,6 +629,7 @@ namespace tools std::vector get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const; std::string get_subaddress_as_str(const cryptonote::subaddress_index& index) const; std::string get_address_as_str() const { return get_subaddress_as_str({0, 0}); } + std::string get_integrated_address_as_str(const crypto::hash8& payment_id) const; void add_subaddress_account(const std::string& label); size_t get_num_subaddress_accounts() const { return m_subaddress_labels.size(); } size_t get_num_subaddresses(uint32_t index_major) const { return index_major < m_subaddress_labels.size() ? m_subaddress_labels[index_major].size() : 0; } diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 8c75031a7..d3491baae 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -1099,6 +1099,69 @@ namespace tools return true; } //------------------------------------------------------------------------------------------------------------------------------ + bool wallet_rpc_server::on_make_integrated_address(const wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er) + { + if (!m_wallet) return not_open(er); + try + { + crypto::hash8 payment_id; + if (req.payment_id.empty()) + { + payment_id = crypto::rand(); + } + else + { + if (!tools::wallet2::parse_short_payment_id(req.payment_id,payment_id)) + { + er.code = WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID; + er.message = "Invalid payment ID"; + return false; + } + } + + res.integrated_address = m_wallet->get_integrated_address_as_str(payment_id); + res.payment_id = epee::string_tools::pod_to_hex(payment_id); + return true; + } + catch (const std::exception& e) + { + handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR); + return false; + } + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ + bool wallet_rpc_server::on_split_integrated_address(const wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er) + { + if (!m_wallet) return not_open(er); + try + { + cryptonote::address_parse_info info; + + if(!get_account_address_from_str(info, m_wallet->nettype(), req.integrated_address)) + { + er.code = WALLET_RPC_ERROR_CODE_WRONG_ADDRESS; + er.message = "Invalid address"; + return false; + } + if(!info.has_payment_id) + { + er.code = WALLET_RPC_ERROR_CODE_WRONG_ADDRESS; + er.message = "Address is not an integrated address"; + return false; + } + res.standard_address = get_account_address_as_str(m_wallet->nettype(), info.is_subaddress, info.address); + res.payment_id = epee::string_tools::pod_to_hex(info.payment_id); + return true; + } + catch (const std::exception& e) + { + handle_rpc_exception(std::current_exception(), er, WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR); + return false; + } + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::on_store(const wallet_rpc::COMMAND_RPC_STORE::request& req, wallet_rpc::COMMAND_RPC_STORE::response& res, epee::json_rpc::error& er) { if (!m_wallet) return not_open(er); diff --git a/src/wallet/wallet_rpc_server.h b/src/wallet/wallet_rpc_server.h index 04e57db11..a68e12d97 100644 --- a/src/wallet/wallet_rpc_server.h +++ b/src/wallet/wallet_rpc_server.h @@ -95,6 +95,8 @@ namespace tools MAP_JON_RPC_WE("get_bulk_payments", on_get_bulk_payments, wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS) MAP_JON_RPC_WE("incoming_transfers", on_incoming_transfers, wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS) MAP_JON_RPC_WE("query_key", on_query_key, wallet_rpc::COMMAND_RPC_QUERY_KEY) + MAP_JON_RPC_WE("make_integrated_address", on_make_integrated_address, wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS) + MAP_JON_RPC_WE("split_integrated_address", on_split_integrated_address, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS) MAP_JON_RPC_WE("stop_wallet", on_stop_wallet, wallet_rpc::COMMAND_RPC_STOP_WALLET) MAP_JON_RPC_WE("rescan_blockchain", on_rescan_blockchain, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN) MAP_JON_RPC_WE("set_tx_notes", on_set_tx_notes, wallet_rpc::COMMAND_RPC_SET_TX_NOTES) @@ -158,6 +160,8 @@ namespace tools bool on_sweep_all(const wallet_rpc::COMMAND_RPC_SWEEP_ALL::request& req, wallet_rpc::COMMAND_RPC_SWEEP_ALL::response& res, epee::json_rpc::error& er); bool on_sweep_single(const wallet_rpc::COMMAND_RPC_SWEEP_SINGLE::request& req, wallet_rpc::COMMAND_RPC_SWEEP_SINGLE::response& res, epee::json_rpc::error& er); bool on_relay_tx(const wallet_rpc::COMMAND_RPC_RELAY_TX::request& req, wallet_rpc::COMMAND_RPC_RELAY_TX::response& res, epee::json_rpc::error& er); + bool on_make_integrated_address(const wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er); + bool on_split_integrated_address(const wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er); bool on_store(const wallet_rpc::COMMAND_RPC_STORE::request& req, wallet_rpc::COMMAND_RPC_STORE::response& res, epee::json_rpc::error& er); bool on_get_payments(const wallet_rpc::COMMAND_RPC_GET_PAYMENTS::request& req, wallet_rpc::COMMAND_RPC_GET_PAYMENTS::response& res, epee::json_rpc::error& er); bool on_get_bulk_payments(const wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS::request& req, wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS::response& res, epee::json_rpc::error& er); diff --git a/src/wallet/wallet_rpc_server_commands_defs.h b/src/wallet/wallet_rpc_server_commands_defs.h index e64f4a189..f264829ad 100644 --- a/src/wallet/wallet_rpc_server_commands_defs.h +++ b/src/wallet/wallet_rpc_server_commands_defs.h @@ -873,6 +873,53 @@ namespace wallet_rpc }; }; + struct COMMAND_RPC_MAKE_INTEGRATED_ADDRESS + { + struct request + { + std::string payment_id; + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(payment_id) + END_KV_SERIALIZE_MAP() + }; + + struct response + { + std::string integrated_address; + std::string payment_id; + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(integrated_address) + KV_SERIALIZE(payment_id) + END_KV_SERIALIZE_MAP() + }; + }; + + struct COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS + { + struct request + { + std::string integrated_address; + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(integrated_address) + END_KV_SERIALIZE_MAP() + }; + + struct response + { + std::string standard_address; + std::string payment_id; + bool is_subaddress; + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(standard_address) + KV_SERIALIZE(payment_id) + KV_SERIALIZE(is_subaddress) + END_KV_SERIALIZE_MAP() + }; + }; struct COMMAND_RPC_STOP_WALLET { -- 2.25.1 From f3ee225f29849b91bd09af3da9af406b9a10bf4f Mon Sep 17 00:00:00 2001 From: wowario Date: Wed, 24 Oct 2018 20:10:33 +0300 Subject: [PATCH 4/5] add lwma3 --- src/cryptonote_basic/difficulty.cpp | 39 +++++++++++++++++++++++++++++ src/cryptonote_basic/difficulty.h | 1 + src/cryptonote_config.h | 2 ++ src/cryptonote_core/blockchain.cpp | 29 ++++++++++++++------- 4 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/cryptonote_basic/difficulty.cpp b/src/cryptonote_basic/difficulty.cpp index 5ec281d35..eb7c65f79 100644 --- a/src/cryptonote_basic/difficulty.cpp +++ b/src/cryptonote_basic/difficulty.cpp @@ -291,4 +291,43 @@ namespace cryptonote { return static_cast(next_D); } } + + // LWMA-3 difficulty algorithm + // Copyright (c) 2017-2018 Zawy, MIT License + difficulty_type next_difficulty_v4(std::vector timestamps, std::vector cumulative_difficulties, size_t height) { + + uint64_t T = DIFFICULTY_TARGET_V2; + uint64_t N = DIFFICULTY_WINDOW_V2; + uint64_t L(0), ST, sum_3_ST(0), next_D, prev_D, this_timestamp, previous_timestamp; + + assert(timestamps.size() == cumulative_difficulties.size() && timestamps.size() <= N+1 ); + + if ( height == DIFFICULTY_HEIGHT_V2 ){ + return static_cast(DIFFICULTY_GUESS); + } + + previous_timestamp = timestamps[0]; + for ( uint64_t i = 1; i <= N; i++) { + if ( timestamps[i] > previous_timestamp ) { + this_timestamp = timestamps[i]; + } else { this_timestamp = previous_timestamp+1; } + ST = std::min(6*T ,this_timestamp - previous_timestamp); + previous_timestamp = this_timestamp; + L += ST * i ; + if ( i > N-3 ) { sum_3_ST += ST; } + } + + next_D = ((cumulative_difficulties[N] - cumulative_difficulties[0])*T*(N+1)*99)/(100*2*L); + prev_D = cumulative_difficulties[N] - cumulative_difficulties[N-1]; + next_D = std::max((prev_D*67)/100, std::min(next_D, (prev_D*150)/100)); + + if ( sum_3_ST < (8*T)/10) { next_D = std::max(next_D,(prev_D*108)/100); } + + if ( next_D < DIFFICULTY_MINIMUM ) { + return static_cast(DIFFICULTY_MINIMUM); + } + else { + return static_cast(next_D); + } + } } diff --git a/src/cryptonote_basic/difficulty.h b/src/cryptonote_basic/difficulty.h index 247896e10..550b4c164 100644 --- a/src/cryptonote_basic/difficulty.h +++ b/src/cryptonote_basic/difficulty.h @@ -55,4 +55,5 @@ namespace cryptonote difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties, size_t target_seconds); difficulty_type next_difficulty_v2(std::vector timestamps, std::vector cumulative_difficulties, size_t target_seconds); difficulty_type next_difficulty_v3(std::vector timestamps, std::vector cumulative_difficulties, size_t height); + difficulty_type next_difficulty_v4(std::vector timestamps, std::vector cumulative_difficulties, size_t height); } diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 82408aab3..e9425605f 100755 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -48,6 +48,7 @@ #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2 #define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 4 +#define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW_V2 11 #define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 60 // MONEY_SUPPLY - total number coins to be generated @@ -82,6 +83,7 @@ #define DIFFICULTY_BLOCKS_COUNT_V2 DIFFICULTY_WINDOW_V2 + 1 // added +1 to make N=N #define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG #define DIFFICULTY_HEIGHT 53666 // v9 fork height +#define DIFFICULTY_HEIGHT_V2 777777 // v10 fork height #define DIFFICULTY_GUESS 40000000 // difficulty at fork 40m #define DIFFICULTY_MINIMUM 25000000 // minimum difficulty set to 25m #define DIFFICULTY_TESTNET_HEIGHT 100 diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index d762d3dfb..f5c68c64c 100755 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -838,8 +838,11 @@ difficulty_type Blockchain::get_difficulty_for_next_block() else if (version == 8) { return next_difficulty_v2(timestamps, difficulties, target); } - else { + else if (version == 9) { return next_difficulty_v3(timestamps, difficulties, height); + } + else { + return next_difficulty_v4(timestamps, difficulties, height); } } //------------------------------------------------------------------ @@ -1056,9 +1059,12 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std: } else if (version == 8) { return next_difficulty_v2(timestamps, cumulative_difficulties, target); - } + } + else if (version == 9) { + return next_difficulty_v2(timestamps, cumulative_difficulties, height); + } else { - return next_difficulty_v3(timestamps, cumulative_difficulties, height); + return next_difficulty_v4(timestamps, cumulative_difficulties, height); } } @@ -1350,12 +1356,13 @@ bool Blockchain::create_block_template(block& b, const account_public_address& m bool Blockchain::complete_timestamps_vector(uint64_t start_top_height, std::vector& timestamps) { LOG_PRINT_L3("Blockchain::" << __func__); - - if(timestamps.size() >= BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW) + const uint8_t hf_version = m_hardfork->get_current_version(); + size_t blockchain_timestamp_check_window = hf_version >= 10 ? BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW_V2 : BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW; + if(timestamps.size() >= blockchain_timestamp_check_window) return true; CRITICAL_REGION_LOCAL(m_blockchain_lock); - size_t need_elements = BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW - timestamps.size(); + size_t need_elements = blockchain_timestamp_check_window - timestamps.size(); CHECK_AND_ASSERT_MES(start_top_height < m_db->height(), false, "internal error: passed start_height not < " << " m_db->height() -- " << start_top_height << " >= " << m_db->height()); size_t stop_offset = start_top_height > need_elements ? start_top_height - need_elements : 0; while (start_top_height != stop_offset) @@ -3203,10 +3210,12 @@ bool Blockchain::check_block_timestamp(std::vector& timestamps, const { LOG_PRINT_L3("Blockchain::" << __func__); median_ts = epee::misc_utils::median(timestamps); + const uint8_t hf_version = m_hardfork->get_current_version(); + size_t blockchain_timestamp_check_window = hf_version >= 10 ? BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW_V2 : BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW; if(b.timestamp < median_ts) { - MERROR_VER("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", less than median of last " << BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW << " blocks, " << median_ts); + MERROR_VER("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", less than median of last " << blockchain_timestamp_check_window << " blocks, " << median_ts); return false; } @@ -3224,6 +3233,8 @@ bool Blockchain::check_block_timestamp(const block& b, uint64_t& median_ts) cons { LOG_PRINT_L3("Blockchain::" << __func__); uint64_t cryptonote_block_future_time_limit = get_current_hard_fork_version() >= 8 ? CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V2 : CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT; + const uint8_t hf_version = m_hardfork->get_current_version(); + size_t blockchain_timestamp_check_window = hf_version >= 10 ? BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW_V2 : BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW; if(b.timestamp > get_adjusted_time() + cryptonote_block_future_time_limit) { MERROR_VER("Timestamp of block with id: " << get_block_hash(b) << ", " << b.timestamp << ", bigger than adjusted time + 10 minutes"); @@ -3231,7 +3242,7 @@ bool Blockchain::check_block_timestamp(const block& b, uint64_t& median_ts) cons } // if not enough blocks, no proper median yet, return true - if(m_db->height() < BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW) + if(m_db->height() < blockchain_timestamp_check_window) { return true; } @@ -3240,7 +3251,7 @@ bool Blockchain::check_block_timestamp(const block& b, uint64_t& median_ts) cons auto h = m_db->height(); // need most recent 60 blocks, get index of first of those - size_t offset = h - BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW; + size_t offset = h - blockchain_timestamp_check_window; for(;offset < h; ++offset) { timestamps.push_back(m_db->get_block_timestamp(offset)); -- 2.25.1 From a8790e240c69f51ef63cc2ad8a152aee4510d3ee Mon Sep 17 00:00:00 2001 From: wowario Date: Thu, 25 Oct 2018 19:14:26 +0300 Subject: [PATCH 5/5] update checkpoints --- src/blocks/checkpoints.dat | Bin 6820 -> 7364 bytes src/checkpoints/checkpoints.cpp | 3 +++ src/cryptonote_core/blockchain.cpp | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/blocks/checkpoints.dat b/src/blocks/checkpoints.dat index fce6c1d4d2ad26993cf781f68309b521643ee9b3..ae16639799f48f9f6caf1d0715352dbab25a8560 100644 GIT binary patch delta 559 zcmV+~0?_@WHN-gq=CJ{z8hWhpV{Ef)uc{Dh3-(ZjS|s-wL+fW3Y0t9Iv-JuROzF1Eselx)+O<;}pOojy(|=NsRf?FX&ONbm z7*wZ?Rb(L!FTLOSiN<7TvfZr>6D+YOY-Q!(26^%kU7hqb*u^3+si+`6$xATBH9IU( zPcQ=#xU$0POUkxs4}W2bolhR(e*$vwe+I=XA+f3vlEJuLWX5!;^=UCTLFEU~M^}3L zuh7qp7{7X3yNxxomS1~9D|%#WvHRjtrx1IU{AoMkkR=X?7$2=hbBkQ<83YwelppdHzw7h?=q(=99w#=TEPr2ex3h!88fWXb&N$Fb zPSOOhb3P{XvI*{?$aait|F%V5W>iLq4SaE0#|Q$kjvNRI0fjV4`hrXRV8>5&dAEQw zA+c$hHCT4a0HB`e5^{l)@bxxaKb+vGqi?)kuH!e)H28~suJN!eFyEF@QI!Ww25|NI x^|UrASkIWM=p=P%Ouo0VEj2eQdilydZGfc&ZuY5K2-hDtVBkXVOVY^*G-7Bd4sHMd delta 10 RcmX?Nxx|$5>PE)JQUDm71RMYW diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index 1fb98f0a3..70a90f785 100755 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -188,6 +188,9 @@ namespace cryptonote ADD_CHECKPOINT(50000, "5286ac2a0f39b3aefcba363cd71f2760bd1e0d763cbc81026ebdc3f80a86541f"); ADD_CHECKPOINT(53666, "3f43f56f66ef0c43cf2fd14d0d28fa2aae0ef8f40716773511345750770f1255"); //Hard fork to v9 ADD_CHECKPOINT(54500, "8ed3078b389c2b44add007803d741b58d3fbed2e1ba4139bda702152d8773c9b"); + ADD_CHECKPOINT(55000, "4b662ceccefc3247edb4d654dd610b8fb496e85b88a5de43cc2bdd28171b15ff"); + ADD_CHECKPOINT(57000, "08a79f09f12bb5d230b63963356a760d51618e526cfc636047a6f3798217c177"); + ADD_CHECKPOINT(59000, "180b51ee2c5fbcd4362eb7a29df9422481310dd77d10bccdf8930724c31e007e"); return true; } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index d762d3dfb..2181f8348 100755 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -4441,7 +4441,7 @@ void Blockchain::cancel() } #if defined(PER_BLOCK_CHECKPOINT) -static const char expected_block_hashes_hash[] = "e8255f4188ddb613df2953d8ae2ed509223e432290368b0eef062f8c12da9f70"; +static const char expected_block_hashes_hash[] = "897d3ae0f3aef8ef8362b0bb3535925738414fa78d9146f8a04c60555fa5a95f"; void Blockchain::load_compiled_in_block_hashes() { const bool testnet = m_nettype == TESTNET; -- 2.25.1