From 081165d535dd8f78508cb17f90c4aea2a8fe6b92 Mon Sep 17 00:00:00 2001 From: Vu Hong Quang Date: Mon, 15 Jul 2019 16:05:35 +0700 Subject: [PATCH 1/4] [MISC] Init and remove unused variables to get rid of compiler warnings --- src/cryptonote_core/blockchain.cpp | 2 +- src/wallet/wallet2.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 626546b336..6740b18369 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -603,7 +603,7 @@ bool Blockchain::deinit() // It starts a batch and calls private method pop_block_from_blockchain(). void Blockchain::pop_blocks(uint64_t nblocks) { - uint64_t i; + uint64_t i(0); CRITICAL_REGION_LOCAL(m_tx_pool); CRITICAL_REGION_LOCAL1(m_blockchain_lock); diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 35bbfcb4b3..9a0767bb45 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -7687,7 +7687,6 @@ void wallet2::get_outs(std::vector> uint64_t num_found = 0; // if we have a known ring, use it - bool existing_ring_found = false; if (td.m_key_image_known && !td.m_key_image_partial) { std::vector ring; @@ -7699,7 +7698,6 @@ void wallet2::get_outs(std::vector> std::to_string(ring.size()) + ", it cannot be spent now with ring size " + std::to_string(fake_outputs_count + 1) + " as it is smaller: use a higher ring size"); bool own_found = false; - existing_ring_found = true; for (const auto &out: ring) { MINFO("Ring has output " << out); From 37a0527e20c5b1e1cd6b921a5ee0388cfc5b28b8 Mon Sep 17 00:00:00 2001 From: Vu Hong Quang Date: Thu, 18 Jul 2019 17:18:25 +0700 Subject: [PATCH 2/4] [CORE] Fix/improve tx pool selection algo --- src/cryptonote_core/tx_pool.cpp | 6 ++++-- src/cryptonote_core/tx_pool.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index e4a507c598..14b531bb34 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -1183,7 +1183,7 @@ namespace cryptonote //baseline empty block get_block_reward(median_weight, total_weight, already_generated_coins, best_coinbase, height); - size_t max_total_weight = 2 * median_weight - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE; + size_t max_total_weight = (200 * median_weight)/100 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE; std::unordered_set k_images; LOG_PRINT_L2("Filling block template, median weight " << median_weight << ", " << m_txs_by_fee_and_receive_time.size() << " txes in the pool"); @@ -1374,7 +1374,9 @@ namespace cryptonote MFATAL("Failed to insert key images from txpool tx"); return false; } - m_txs_by_fee_and_receive_time.emplace(std::pair(meta.fee / (double)meta.weight, meta.receive_time), txid); + // Rounding tx fee/blob_size ratio so that txs with the same priority would be sorted by receive_time + uint32_t fee_per_size_ratio = (uint32_t)(meta.fee / (double)meta.weight); + m_txs_by_fee_and_receive_time.emplace(std::pair(fee_per_size_ratio, meta.receive_time), txid); m_txpool_weight += meta.weight; return true; }, true); diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index 75d6195f81..f277b56d17 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -56,7 +56,7 @@ namespace cryptonote /************************************************************************/ //! pair of for organization - typedef std::pair, crypto::hash> tx_by_fee_and_receive_time_entry; + typedef std::pair, crypto::hash> tx_by_fee_and_receive_time_entry; class txCompare { From 705d97b7c151cd881074cb38f7774f8d5870db0b Mon Sep 17 00:00:00 2001 From: Vu Hong Quang Date: Mon, 22 Jul 2019 10:23:46 +0700 Subject: [PATCH 3/4] [P2P] Add missing connection close calls - [cryptonote_protocol] Drop peers we can't download from when syncing Ref: https://github.com/monero-project/monero/pull/5732/commits --- src/cryptonote_protocol/cryptonote_protocol_handler.inl | 5 +++++ src/p2p/net_node.inl | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index d8a9a7cbf4..7fd24405b1 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -341,6 +341,11 @@ namespace cryptonote if(m_core.have_block(hshd.top_id)) { + if (target > hshd.current_height) + { + MINFO(context << "peer is not ahead of us and we're syncing, disconnecting"); + return false; + } context.m_state = cryptonote_connection_context::state_normal; if(is_inital && target == m_core.get_current_blockchain_height()) on_connection_synchronized(); diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index d4cce8bd49..4f8f24035b 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -945,7 +945,10 @@ namespace nodetool } if(!context.m_is_income) m_network_zones.at(context.m_remote_address.get_zone()).m_peerlist.set_peer_just_seen(context.peer_id, context.m_remote_address, context.m_pruning_seed, context.m_rpc_port); - m_payload_handler.process_payload_sync_data(rsp.payload_data, context, false); + if (!m_payload_handler.process_payload_sync_data(rsp.payload_data, context, false)) + { + m_network_zones.at(context.m_remote_address.get_zone()).m_net_server.get_config_object().close(context.m_connection_id ); + } }); if(!r) @@ -1091,6 +1094,7 @@ namespace nodetool LOG_PRINT_CC_PRIORITY_NODE(is_priority, *con, "Failed to HANDSHAKE with peer " << na.str() /*<< ", try " << try_count*/); + zone.m_net_server.get_config_object().close(con->m_connection_id); return false; } @@ -1150,7 +1154,7 @@ namespace nodetool bool is_priority = is_priority_node(na); LOG_PRINT_CC_PRIORITY_NODE(is_priority, *con, "Failed to HANDSHAKE with peer " << na.str()); - + zone.m_net_server.get_config_object().close(con->m_connection_id); return false; } From bbc7751d6c0aa13669178e4c48a6be7d16471bb1 Mon Sep 17 00:00:00 2001 From: Sumoshi Tanaka Date: Mon, 22 Jul 2019 12:47:04 +0700 Subject: [PATCH 4/4] [CORE] Prepare for (minor) release point v0.5.1.1 - Update checkpoints - Bump version to 0.5.1.1 --- src/blocks/checkpoints.dat | Bin 36772 -> 38372 bytes src/checkpoints/checkpoints.cpp | 2 +- src/cryptonote_core/blockchain.cpp | 2 +- src/version.cpp.in | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blocks/checkpoints.dat b/src/blocks/checkpoints.dat index eddfcd4644a8c32bdc464b5e19b40d6d28305a88..ea0ae4d786cf585922a39d44825d841aba8e562d 100644 GIT binary patch delta 1625 zcmV-f2B!I>p918o0s*hF0i%z9qr^(d+}cO$ZgzD($VtSQEPG!d!Y@dpB_)6&AS}c+ zC(^P`9H5TO6TkZOeo;>CJnPYfm}UxvPBZ{~DrbKd7!hK|=$fDDX$uzrS9Rl?G#6bN zj8#f|h$+G$b=yPi#_O0%n{I71DARA8xi2VzuyXEyH93b!QDwEI zah{S<+PEjr7>zja-zWM(v+Z%9dECNoK6qSyic__$_wa~_}l5YBmkJSNxHmk$B;B(!5X0Y(x01~;iiXO6j3kc5BP`{4f2#xv9_rza>mYup%5tdw36D`u`Auw`VW72JA{=2 zR>?{OY8bai_HdvI)*bWWtgL}X6%AjtvHumPk02zwTEdxS1w|f%gY;_%h4{dzU36c73#o4HZXZ=teRdvE(5K z(r(aWGXt)2&t*4Zgdx)5ND`}){-ArO(^KzYky`dsOb)`!mTXcfFsjgsR1fO3U?uOtJo`TnJ?M`Iq1!k_bromw}7&X(`YD|I4Wx_eufB`0GsX^VIqA% z9d15#b*v}%+6Sjr3~-cyefv+Vsy4D~?@{Gvp0zH2fkXD*3-%9SExmp2U~Fm7AsG5%ambBtU4$${o9rA$-OYyz>P?k zeHQ9}`_>3cP7tmnCkjEag|CWzu!O)gKw4t79^}VShX^fdsddE6ZvJkgjUX#?yW46j z?^31Tr$2TdOnrB2B9h`W3N>*BnLJofwUS=YK?<_ONNspNCPX{ybV0E~B2+1aSJhf& zEYx43sgy@UE?R%EmFrmC~ z)2-EbzM*BGnF2~`5(C(^#HQ??d(K)|^hK$4sq$)X1i_nF+WFK&>a;N%eW7sHb%*Gt zVE&9H)}+}Fx{s(2ZJQq6vG9h9l)aFD7Z|Z$8n=<&>8h1%1_sq6Xxek9Avuc~EscjO zu8DvcQ|&E=t}1*xBVz3X#^gbm-|SDi;?)r^N$lTlQHCP}(&Fd~q;sSjMvF2EuPIWD zypmh*s|h^j|Kzj3v}VRKlw{4AQOP#J~T1S&$pUL31B}`dDL3P)!44 ztWxT-7YMMJHL4d5oxpT$>Y3i>G^d7VqyY$(F+a2lTgMI%+1_2_-BB>(TFbFBnI6%6 X09i}ws>kKXaXM+2W)@wA%B>Kv#4;a0 delta 12 TcmaE|nrX>=CdS&0jEnmLBnAaJ diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index 1dcc381b81..10d9b38bce 100644 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -187,7 +187,7 @@ namespace cryptonote ADD_CHECKPOINT(199800, "d8c7fcfcf605e834b3125b68cc96736e1f1d2f753c79c24db8fb9d6af4b84293"); // v6 fork ADD_CHECKPOINT(274000, "49d2579161c277b9d9fe6baba5aabcef1534e9abef93eaa7f17cc8fe229454b0"); // v7 fork ADD_CHECKPOINT(274360, "66c129116187f36980a97333f1c7cf99c21629cc52bc6d591126d3a8fe36b90a"); // v8 fork - ADD_CHECKPOINT(294360, "81b86ce75b91efcb329376eda835531fb05657d2f184a2ed9e899dba54f0515e"); + ADD_CHECKPOINT(300000, "b09b147b23148d2995ff860d9ede9d8d38757c934b6de7945d397fc4e1ab2501"); return true; } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 6740b18369..58c312a9f2 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -4901,7 +4901,7 @@ void Blockchain::cancel() } #if defined(PER_BLOCK_CHECKPOINT) -static const char expected_block_hashes_hash[] = "8bd6c4fff119d791d1be231a3743fa3978368cabdcd513fccfad4656e8ce2c57"; +static const char expected_block_hashes_hash[] = "d890ae0285728cc2c95a39fdf27d2c3c96aa86a1a9e841ad7d2f2a5a54df9033"; void Blockchain::load_compiled_in_block_hashes(const GetCheckpointsCallback& get_checkpoints) { if (get_checkpoints == nullptr || !m_fast_sync) diff --git a/src/version.cpp.in b/src/version.cpp.in index 346a152d22..9a6a61918c 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_SUMOKOIN_VERSION_TAG "@VERSIONTAG@" -#define DEF_SUMOKOIN_VERSION "0.5.1.0" +#define DEF_SUMOKOIN_VERSION "0.5.1.1" #define DEF_SUMOKOIN_RELEASE_NAME "Morioka" #define DEF_SUMOKOIN_VERSION_FULL DEF_SUMOKOIN_VERSION "-" DEF_SUMOKOIN_VERSION_TAG