mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-17 14:00:04 -07:00
protocol: remove hop count on block propagation
It is unused, as it was apparently a future optimization, and it leaks some information (though since pools publish thei blocks they find, that amount seems small).
This commit is contained in:
parent
7abdba0a5c
commit
7f2f6ee1c9
@ -91,7 +91,6 @@
|
||||
#define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing
|
||||
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4 100 //by default, blocks count in blocks downloading
|
||||
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 //by default, blocks count in blocks downloading
|
||||
#define CRYPTONOTE_PROTOCOL_HOP_RELAX_COUNT 3 //value of hop, after which we use only announce of new block
|
||||
|
||||
#define CRYPTONOTE_MEMPOOL_TX_LIVETIME 86400 //seconds, one day
|
||||
#define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week
|
||||
|
@ -1035,7 +1035,6 @@ namespace cryptonote
|
||||
{
|
||||
cryptonote_connection_context exclude_context = boost::value_initialized<cryptonote_connection_context>();
|
||||
NOTIFY_NEW_BLOCK::request arg = AUTO_VAL_INIT(arg);
|
||||
arg.hop = 0;
|
||||
arg.current_blockchain_height = m_blockchain_storage.get_current_blockchain_height();
|
||||
std::list<crypto::hash> missed_txs;
|
||||
std::list<cryptonote::blobdata> txs;
|
||||
|
@ -128,12 +128,10 @@ namespace cryptonote
|
||||
{
|
||||
block_complete_entry b;
|
||||
uint64_t current_blockchain_height;
|
||||
uint32_t hop;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(b)
|
||||
KV_SERIALIZE(current_blockchain_height)
|
||||
KV_SERIALIZE(hop)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
@ -254,12 +252,10 @@ namespace cryptonote
|
||||
{
|
||||
block_complete_entry b;
|
||||
uint64_t current_blockchain_height;
|
||||
uint32_t hop;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(b)
|
||||
KV_SERIALIZE(current_blockchain_height)
|
||||
KV_SERIALIZE(hop)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
@ -276,13 +272,11 @@ namespace cryptonote
|
||||
crypto::hash block_hash;
|
||||
uint64_t current_blockchain_height;
|
||||
std::vector<size_t> missing_tx_indices;
|
||||
uint32_t hop;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE_VAL_POD_AS_BLOB(block_hash)
|
||||
KV_SERIALIZE(current_blockchain_height)
|
||||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(missing_tx_indices)
|
||||
KV_SERIALIZE(hop)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
};
|
||||
|
@ -336,7 +336,7 @@ namespace cryptonote
|
||||
template<class t_core>
|
||||
int t_cryptonote_protocol_handler<t_core>::handle_notify_new_block(int command, NOTIFY_NEW_BLOCK::request& arg, cryptonote_connection_context& context)
|
||||
{
|
||||
MLOG_P2P_MESSAGE("Received NOTIFY_NEW_BLOCK (hop " << arg.hop << ", " << arg.b.txs.size() << " txes)");
|
||||
MLOG_P2P_MESSAGE("Received NOTIFY_NEW_BLOCK (" << arg.b.txs.size() << " txes)");
|
||||
if(context.m_state != cryptonote_connection_context::state_normal)
|
||||
return 1;
|
||||
if(!is_synchronized()) // can happen if a peer connection goes to normal but another thread still hasn't finished adding queued blocks
|
||||
@ -379,7 +379,6 @@ namespace cryptonote
|
||||
}
|
||||
if(bvc.m_added_to_main_chain)
|
||||
{
|
||||
++arg.hop;
|
||||
//TODO: Add here announce protocol usage
|
||||
relay_block(arg, context);
|
||||
}else if(bvc.m_marked_as_orphaned)
|
||||
@ -397,7 +396,7 @@ namespace cryptonote
|
||||
template<class t_core>
|
||||
int t_cryptonote_protocol_handler<t_core>::handle_notify_new_fluffy_block(int command, NOTIFY_NEW_FLUFFY_BLOCK::request& arg, cryptonote_connection_context& context)
|
||||
{
|
||||
MLOG_P2P_MESSAGE("Received NOTIFY_NEW_FLUFFY_BLOCK (height " << arg.current_blockchain_height << ", hop " << arg.hop << ", " << arg.b.txs.size() << " txes)");
|
||||
MLOG_P2P_MESSAGE("Received NOTIFY_NEW_FLUFFY_BLOCK (height " << arg.current_blockchain_height << ", " << arg.b.txs.size() << " txes)");
|
||||
if(context.m_state != cryptonote_connection_context::state_normal)
|
||||
return 1;
|
||||
if(!is_synchronized()) // can happen if a peer connection goes to normal but another thread still hasn't finished adding queued blocks
|
||||
@ -607,7 +606,6 @@ namespace cryptonote
|
||||
MDEBUG(" tx " << new_block.tx_hashes[txidx]);
|
||||
NOTIFY_REQUEST_FLUFFY_MISSING_TX::request missing_tx_req;
|
||||
missing_tx_req.block_hash = get_block_hash(new_block);
|
||||
missing_tx_req.hop = arg.hop;
|
||||
missing_tx_req.current_blockchain_height = arg.current_blockchain_height;
|
||||
missing_tx_req.missing_tx_indices = std::move(need_tx_indices);
|
||||
|
||||
@ -644,10 +642,8 @@ namespace cryptonote
|
||||
}
|
||||
if( bvc.m_added_to_main_chain )
|
||||
{
|
||||
++arg.hop;
|
||||
//TODO: Add here announce protocol usage
|
||||
NOTIFY_NEW_BLOCK::request reg_arg = AUTO_VAL_INIT(reg_arg);
|
||||
reg_arg.hop = arg.hop;
|
||||
reg_arg.current_blockchain_height = arg.current_blockchain_height;
|
||||
reg_arg.b = b;
|
||||
relay_block(reg_arg, context);
|
||||
@ -700,7 +696,6 @@ namespace cryptonote
|
||||
NOTIFY_NEW_FLUFFY_BLOCK::request fluffy_response;
|
||||
fluffy_response.b.block = t_serializable_object_to_blob(b);
|
||||
fluffy_response.current_blockchain_height = arg.current_blockchain_height;
|
||||
fluffy_response.hop = arg.hop;
|
||||
for(auto& tx_idx: arg.missing_tx_indices)
|
||||
{
|
||||
if(tx_idx < b.tx_hashes.size())
|
||||
@ -1605,7 +1600,6 @@ skip:
|
||||
bool t_cryptonote_protocol_handler<t_core>::relay_block(NOTIFY_NEW_BLOCK::request& arg, cryptonote_connection_context& exclude_context)
|
||||
{
|
||||
NOTIFY_NEW_FLUFFY_BLOCK::request fluffy_arg = AUTO_VAL_INIT(fluffy_arg);
|
||||
fluffy_arg.hop = arg.hop;
|
||||
fluffy_arg.current_blockchain_height = arg.current_blockchain_height;
|
||||
std::list<blobdata> fluffy_txs;
|
||||
fluffy_arg.b = arg.b;
|
||||
|
Loading…
Reference in New Issue
Block a user