Fixes 1:Send a large number of requests synchronously.
The get_network_block_database_hash will send many NODE_TO_BLOCK_VERIFIERS_GET_RESERVE_BYTES_DATABASE_HASH function.
By judging whether the root node participates in verification, a large number of unnecessary requests can be reduced, and the speed can be increased by 5 ~10 times.And reduce timeout time to 20 second because every request may block 60 second when some node have problem.With optimization,the request with NODE_TO_BLOCK_VERIFIERS_GET_RESERVE_BYTES_DATABASE_HASH function will be reduced from 30 to 3 when root node is stable.
And also can reduce sync "Your block height is not synced correctly, waiting for the next round to begin" problem from xcashd sync too late.
Fixes 2:Safe hash validate.
The random_network_data_node may connect to a problem node.When add block function also from this node may lead some node got bad hash.If the random node call NODE_TO_NETWORK_DATA_NODES_GET_CURRENT_BLOCK_VERIFIERS_LIST_MESSAGE return some bad ip witch all link to his server.Can pass network verification add bad data to blockchain when node and random_network_data_node all target it.
(Can edit cryptonote_config.h make OPEN_SAFE_VALIDATE to 1 active this validate)
Description
Optimization some blockchain sync function
Fixes 1:Send a large number of requests synchronously.
The get_network_block_database_hash will send many NODE_TO_BLOCK_VERIFIERS_GET_RESERVE_BYTES_DATABASE_HASH function. By judging whether the root node participates in verification, a large number of unnecessary requests can be reduced, and the speed can be increased by 5 ~10 times.And reduce timeout time to 20 second because every request may block 60 second when some node have problem.With optimization,the request with NODE_TO_BLOCK_VERIFIERS_GET_RESERVE_BYTES_DATABASE_HASH function will be reduced from 30 to 3 when root node is stable. And also can reduce sync "Your block height is not synced correctly, waiting for the next round to begin" problem from xcashd sync too late.
Fixes 2:Safe hash validate.
The random_network_data_node may connect to a problem node.When add block function also from this node may lead some node got bad hash.If the random node call NODE_TO_NETWORK_DATA_NODES_GET_CURRENT_BLOCK_VERIFIERS_LIST_MESSAGE return some bad ip witch all link to his server.Can pass network verification add bad data to blockchain when node and random_network_data_node all target it. (Can edit cryptonote_config.h make OPEN_SAFE_VALIDATE to 1 active this validate)