mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #5877
2cd4fd8
Changed the use of boost:value_initialized for C++ list initializer (JesusRami)4ad191f
Removed unused boost/value_init header (whyamiroot)928f4be
Make null hash constants constexpr (whyamiroot)
This commit is contained in:
commit
ee6e849627
13 changed files with 35 additions and 38 deletions
|
@ -225,7 +225,7 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
|
|||
|
||||
// process block
|
||||
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
|
||||
core.handle_incoming_block(block_entry.block, pblocks.empty() ? NULL : &pblocks[blockidx++], bvc, false); // <--- process block
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include <stddef.h>
|
||||
#include <iostream>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
|
||||
#include "common/pod-class.h"
|
||||
#include "generic-ops.h"
|
||||
|
@ -90,8 +89,8 @@ namespace crypto {
|
|||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
|
||||
const static crypto::hash null_hash = boost::value_initialized<crypto::hash>();
|
||||
const static crypto::hash8 null_hash8 = boost::value_initialized<crypto::hash8>();
|
||||
constexpr static crypto::hash null_hash = {};
|
||||
constexpr static crypto::hash8 null_hash8 = {};
|
||||
}
|
||||
|
||||
CRYPTO_MAKE_HASHABLE(hash)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include <sstream>
|
||||
#include <numeric>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/interprocess/detail/atomic.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "misc_language.h"
|
||||
|
@ -100,7 +99,7 @@ namespace cryptonote
|
|||
|
||||
|
||||
miner::miner(i_miner_handler* phandler):m_stop(1),
|
||||
m_template(boost::value_initialized<block>()),
|
||||
m_template{},
|
||||
m_template_no(0),
|
||||
m_diffic(0),
|
||||
m_thread_index(0),
|
||||
|
|
|
@ -340,7 +340,7 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline
|
|||
{
|
||||
MINFO("Blockchain not loaded, generating genesis block.");
|
||||
block bl;
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
generate_genesis_block(bl, get_config(m_nettype).GENESIS_TX, get_config(m_nettype).GENESIS_NONCE);
|
||||
db_wtxn_guard wtxn_guard(m_db);
|
||||
add_new_block(bl, bvc);
|
||||
|
@ -649,7 +649,7 @@ bool Blockchain::reset_and_set_genesis_block(const block& b)
|
|||
m_hardfork->init();
|
||||
|
||||
db_wtxn_guard wtxn_guard(m_db);
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
add_new_block(b, bvc);
|
||||
if (!update_next_cumulative_weight_limit())
|
||||
return false;
|
||||
|
@ -919,7 +919,7 @@ bool Blockchain::rollback_blockchain_switching(std::list<block>& original_chain,
|
|||
//return back original chain
|
||||
for (auto& bl : original_chain)
|
||||
{
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
bool r = handle_block_to_main_chain(bl, bvc);
|
||||
CHECK_AND_ASSERT_MES(r && bvc.m_added_to_main_chain, false, "PANIC! failed to add (again) block while chain switching during the rollback!");
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<block_extended_info>
|
|||
for(auto alt_ch_iter = alt_chain.begin(); alt_ch_iter != alt_chain.end(); alt_ch_iter++)
|
||||
{
|
||||
const auto &bei = *alt_ch_iter;
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
|
||||
// add block to main chain
|
||||
bool r = handle_block_to_main_chain(bei.bl, bvc);
|
||||
|
@ -1011,7 +1011,7 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<block_extended_info>
|
|||
//pushing old chain as alternative chain
|
||||
for (auto& old_ch_ent : disconnected_chain)
|
||||
{
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
bool r = handle_alternative_block(old_ch_ent, get_block_hash(old_ch_ent), bvc);
|
||||
if(!r)
|
||||
{
|
||||
|
@ -1333,7 +1333,7 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
|
|||
|
||||
//we have new block in alternative chain
|
||||
std::list<block_extended_info> alt_chain;
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
std::vector<uint64_t> timestamps;
|
||||
if (!build_alt_chain(*from_block, alt_chain, timestamps, bvc))
|
||||
return false;
|
||||
|
@ -1367,7 +1367,7 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
|
|||
}
|
||||
|
||||
// FIXME: consider moving away from block_extended_info at some point
|
||||
block_extended_info bei = boost::value_initialized<block_extended_info>();
|
||||
block_extended_info bei = {};
|
||||
bei.bl = b;
|
||||
bei.height = alt_chain.size() ? prev_data.height + 1 : m_db->get_block_height(*from_block) + 1;
|
||||
|
||||
|
@ -1655,7 +1655,7 @@ bool Blockchain::handle_alternative_block(const block& b, const crypto::hash& id
|
|||
return false;
|
||||
|
||||
// FIXME: consider moving away from block_extended_info at some point
|
||||
block_extended_info bei = boost::value_initialized<block_extended_info>();
|
||||
block_extended_info bei = {};
|
||||
bei.bl = b;
|
||||
const uint64_t prev_height = alt_chain.size() ? prev_data.height : m_db->get_block_height(b.prev_id);
|
||||
bei.height = prev_height + 1;
|
||||
|
|
|
@ -747,7 +747,7 @@ namespace cryptonote
|
|||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::handle_incoming_tx_pre(const blobdata& tx_blob, tx_verification_context& tvc, cryptonote::transaction &tx, crypto::hash &tx_hash, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||
{
|
||||
tvc = boost::value_initialized<tx_verification_context>();
|
||||
tvc = {};
|
||||
|
||||
if(tx_blob.size() > get_max_tx_size())
|
||||
{
|
||||
|
@ -1346,7 +1346,7 @@ namespace cryptonote
|
|||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::handle_block_found(block& b, block_verification_context &bvc)
|
||||
{
|
||||
bvc = boost::value_initialized<block_verification_context>();
|
||||
bvc = {};
|
||||
m_miner.pause();
|
||||
std::vector<block_complete_entry> blocks;
|
||||
try
|
||||
|
@ -1375,7 +1375,7 @@ namespace cryptonote
|
|||
CHECK_AND_ASSERT_MES(!bvc.m_verifivation_failed, false, "mined block failed verification");
|
||||
if(bvc.m_added_to_main_chain)
|
||||
{
|
||||
cryptonote_connection_context exclude_context = boost::value_initialized<cryptonote_connection_context>();
|
||||
cryptonote_connection_context exclude_context = {};
|
||||
NOTIFY_NEW_BLOCK::request arg = AUTO_VAL_INIT(arg);
|
||||
arg.current_blockchain_height = m_blockchain_storage.get_current_blockchain_height();
|
||||
std::vector<crypto::hash> missed_txs;
|
||||
|
@ -1443,7 +1443,7 @@ namespace cryptonote
|
|||
{
|
||||
TRY_ENTRY();
|
||||
|
||||
bvc = boost::value_initialized<block_verification_context>();
|
||||
bvc = {};
|
||||
|
||||
if (!check_incoming_block_size(block_blob))
|
||||
{
|
||||
|
|
|
@ -647,7 +647,7 @@ namespace cryptonote
|
|||
)
|
||||
{
|
||||
//genesis block
|
||||
bl = boost::value_initialized<block>();
|
||||
bl = {};
|
||||
|
||||
blobdata tx_bl;
|
||||
bool r = string_tools::parse_hexstr_to_binbuff(genesis_tx, tx_bl);
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace cryptonote
|
|||
|
||||
if(context.m_state == cryptonote_connection_context::state_synchronizing)
|
||||
{
|
||||
NOTIFY_REQUEST_CHAIN::request r = boost::value_initialized<NOTIFY_REQUEST_CHAIN::request>();
|
||||
NOTIFY_REQUEST_CHAIN::request r = {};
|
||||
context.m_needed_objects.clear();
|
||||
m_core.get_short_chain_history(r.block_ids);
|
||||
handler_request_blocks_history( r.block_ids ); // change the limit(?), sleep(?)
|
||||
|
@ -426,7 +426,7 @@ namespace cryptonote
|
|||
template<class t_core>
|
||||
bool t_cryptonote_protocol_handler<t_core>::get_payload_sync_data(blobdata& data)
|
||||
{
|
||||
CORE_SYNC_DATA hsd = boost::value_initialized<CORE_SYNC_DATA>();
|
||||
CORE_SYNC_DATA hsd = {};
|
||||
get_payload_sync_data(hsd);
|
||||
epee::serialization::store_t_to_binary(hsd, data);
|
||||
return true;
|
||||
|
@ -468,7 +468,7 @@ namespace cryptonote
|
|||
}
|
||||
}
|
||||
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
m_core.handle_incoming_block(arg.b.block, pblocks.empty() ? NULL : &pblocks[0], bvc); // got block from handle_notify_new_block
|
||||
if (!m_core.cleanup_handle_incoming_blocks(true))
|
||||
{
|
||||
|
@ -491,7 +491,7 @@ namespace cryptonote
|
|||
{
|
||||
context.m_needed_objects.clear();
|
||||
context.m_state = cryptonote_connection_context::state_synchronizing;
|
||||
NOTIFY_REQUEST_CHAIN::request r = boost::value_initialized<NOTIFY_REQUEST_CHAIN::request>();
|
||||
NOTIFY_REQUEST_CHAIN::request r = {};
|
||||
m_core.get_short_chain_history(r.block_ids);
|
||||
handler_request_blocks_history( r.block_ids ); // change the limit(?), sleep(?)
|
||||
MLOG_P2P_MESSAGE("-->>NOTIFY_REQUEST_CHAIN: m_block_ids.size()=" << r.block_ids.size() );
|
||||
|
@ -740,7 +740,7 @@ namespace cryptonote
|
|||
return 1;
|
||||
}
|
||||
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
m_core.handle_incoming_block(arg.b.block, pblocks.empty() ? NULL : &pblocks[0], bvc); // got block from handle_notify_new_block
|
||||
if (!m_core.cleanup_handle_incoming_blocks(true))
|
||||
{
|
||||
|
@ -768,7 +768,7 @@ namespace cryptonote
|
|||
{
|
||||
context.m_needed_objects.clear();
|
||||
context.m_state = cryptonote_connection_context::state_synchronizing;
|
||||
NOTIFY_REQUEST_CHAIN::request r = boost::value_initialized<NOTIFY_REQUEST_CHAIN::request>();
|
||||
NOTIFY_REQUEST_CHAIN::request r = {};
|
||||
m_core.get_short_chain_history(r.block_ids);
|
||||
handler_request_blocks_history( r.block_ids ); // change the limit(?), sleep(?)
|
||||
MLOG_P2P_MESSAGE("-->>NOTIFY_REQUEST_CHAIN: m_block_ids.size()=" << r.block_ids.size() );
|
||||
|
@ -1306,7 +1306,7 @@ namespace cryptonote
|
|||
// process block
|
||||
|
||||
TIME_MEASURE_START(block_process_time);
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
block_verification_context bvc = {};
|
||||
|
||||
m_core.handle_incoming_block(block_entry.block, pblocks.empty() ? NULL : &pblocks[blockidx], bvc, false); // <--- process block
|
||||
|
||||
|
@ -2010,7 +2010,7 @@ skip:
|
|||
if(context.m_last_response_height < context.m_remote_blockchain_height-1)
|
||||
{//we have to fetch more objects ids, request blockchain entry
|
||||
|
||||
NOTIFY_REQUEST_CHAIN::request r = boost::value_initialized<NOTIFY_REQUEST_CHAIN::request>();
|
||||
NOTIFY_REQUEST_CHAIN::request r = {};
|
||||
m_core.get_short_chain_history(r.block_ids);
|
||||
CHECK_AND_ASSERT_MES(!r.block_ids.empty(), false, "Short chain history is empty");
|
||||
|
||||
|
|
|
@ -1556,7 +1556,7 @@ namespace cryptonote
|
|||
template_req.reserve_size = 1;
|
||||
template_req.wallet_address = req.wallet_address;
|
||||
template_req.prev_block = req.prev_block;
|
||||
submit_req.push_back(boost::value_initialized<std::string>());
|
||||
submit_req.push_back(std::string{});
|
||||
res.height = m_core.get_blockchain_storage().get_current_blockchain_height();
|
||||
|
||||
for(size_t i = 0; i < req.amount_of_blocks; i++)
|
||||
|
|
|
@ -699,7 +699,7 @@ void message_store::write_to_file(const multisig_wallet_state &state, const std:
|
|||
crypto::chacha_key key;
|
||||
crypto::generate_chacha_key(&state.view_secret_key, sizeof(crypto::secret_key), key, 1);
|
||||
|
||||
file_data write_file_data = boost::value_initialized<file_data>();
|
||||
file_data write_file_data = {};
|
||||
write_file_data.magic_string = "MMS";
|
||||
write_file_data.file_version = 0;
|
||||
write_file_data.iv = crypto::rand<crypto::chacha_iv>();
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <tuple>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
|
@ -1999,7 +1998,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
|||
uint64_t amount = tx.vout[o].amount ? tx.vout[o].amount : tx_scan_info[o].amount;
|
||||
if (!pool)
|
||||
{
|
||||
m_transfers.push_back(boost::value_initialized<transfer_details>());
|
||||
m_transfers.push_back(transfer_details{});
|
||||
transfer_details& td = m_transfers.back();
|
||||
td.m_block_height = height;
|
||||
td.m_internal_output_index = o;
|
||||
|
@ -3572,7 +3571,7 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable
|
|||
|
||||
bool r = epee::serialization::store_t_to_binary(account, account_data);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to serialize wallet keys");
|
||||
wallet2::keys_file_data keys_file_data = boost::value_initialized<wallet2::keys_file_data>();
|
||||
wallet2::keys_file_data keys_file_data = {};
|
||||
|
||||
// Create a JSON object with "key_data" and "seed_language" as keys.
|
||||
rapidjson::Document json;
|
||||
|
@ -5545,7 +5544,7 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas
|
|||
boost::archive::portable_binary_oarchive ar(oss);
|
||||
ar << *this;
|
||||
|
||||
wallet2::cache_file_data cache_file_data = boost::value_initialized<wallet2::cache_file_data>();
|
||||
wallet2::cache_file_data cache_file_data = {};
|
||||
cache_file_data.cache_data = oss.str();
|
||||
std::string cipher;
|
||||
cipher.resize(cache_file_data.cache_data.size());
|
||||
|
@ -8828,7 +8827,7 @@ void wallet2::light_wallet_get_unspent_outs()
|
|||
if(!add_transfer)
|
||||
continue;
|
||||
|
||||
m_transfers.push_back(boost::value_initialized<transfer_details>());
|
||||
m_transfers.push_back(transfer_details{});
|
||||
transfer_details& td = m_transfers.back();
|
||||
|
||||
td.m_block_height = o.height;
|
||||
|
|
|
@ -529,7 +529,7 @@ bool gen_tx_key_image_not_derive_from_tx_key::generate(std::vector<test_event_en
|
|||
// Tx with invalid key image can't be subscribed, so create empty signature
|
||||
builder.m_tx.signatures.resize(1);
|
||||
builder.m_tx.signatures[0].resize(1);
|
||||
builder.m_tx.signatures[0][0] = boost::value_initialized<crypto::signature>();
|
||||
builder.m_tx.signatures[0][0] = crypto::signature{};
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(builder.m_tx);
|
||||
|
@ -562,7 +562,7 @@ bool gen_tx_key_image_is_invalid::generate(std::vector<test_event_entry>& events
|
|||
// Tx with invalid key image can't be subscribed, so create empty signature
|
||||
builder.m_tx.signatures.resize(1);
|
||||
builder.m_tx.signatures[0].resize(1);
|
||||
builder.m_tx.signatures[0][0] = boost::value_initialized<crypto::signature>();
|
||||
builder.m_tx.signatures[0][0] = crypto::signature{};
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(builder.m_tx);
|
||||
|
|
|
@ -253,7 +253,7 @@ bool transactions_flow_test(std::string& working_folder,
|
|||
transfered_money += amount_to_tx;
|
||||
|
||||
LOG_PRINT_L0("transferred " << amount_to_tx << ", i=" << i );
|
||||
tx_test_entry& ent = txs[get_transaction_hash(tx)] = boost::value_initialized<tx_test_entry>();
|
||||
tx_test_entry& ent = txs[get_transaction_hash(tx)] = tx_test_entry{};
|
||||
ent.amount_transfered = amount_to_tx;
|
||||
ent.tx = tx;
|
||||
//if(i % transactions_per_second)
|
||||
|
|
|
@ -42,7 +42,7 @@ TEST(protocol_pack, protocol_pack_command)
|
|||
r.total_height = 3;
|
||||
for(int i = 1; i < 10000; i += i*10)
|
||||
{
|
||||
r.m_block_ids.resize(i, boost::value_initialized<crypto::hash>());
|
||||
r.m_block_ids.resize(i, crypto::hash{});
|
||||
bool res = epee::serialization::store_t_to_binary(r, buff);
|
||||
ASSERT_TRUE(res);
|
||||
|
||||
|
|
Loading…
Reference in a new issue