mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Changed the use of boost:value_initialized for C++ list initializer
This commit is contained in:
parent
98af2e954b
commit
2cd4fd8972
13 changed files with 35 additions and 35 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
|
||||
|
||||
|
|
|
@ -90,8 +90,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>();
|
||||
const static crypto::hash null_hash = {};
|
||||
const static crypto::hash8 null_hash8 = {};
|
||||
}
|
||||
|
||||
CRYPTO_MAKE_HASHABLE(hash)
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace cryptonote
|
|||
|
||||
|
||||
miner::miner(i_miner_handler* phandler):m_stop(1),
|
||||
m_template(boost::value_initialized<block>()),
|
||||
m_template(block{}),
|
||||
m_template_no(0),
|
||||
m_diffic(0),
|
||||
m_thread_index(0),
|
||||
|
|
|
@ -428,7 +428,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);
|
||||
|
@ -736,7 +736,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;
|
||||
|
@ -1006,7 +1006,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!");
|
||||
}
|
||||
|
@ -1055,7 +1055,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);
|
||||
|
@ -1098,7 +1098,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)
|
||||
{
|
||||
|
@ -1412,7 +1412,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;
|
||||
|
@ -1446,7 +1446,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;
|
||||
|
||||
|
@ -1733,7 +1733,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;
|
||||
|
|
|
@ -746,7 +746,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())
|
||||
{
|
||||
|
@ -1345,7 +1345,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
|
||||
|
@ -1374,7 +1374,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;
|
||||
|
@ -1442,7 +1442,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");
|
||||
|
||||
|
|
|
@ -1509,7 +1509,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>();
|
||||
|
|
|
@ -1973,7 +1973,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;
|
||||
|
@ -3531,7 +3531,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;
|
||||
|
@ -5498,7 +5498,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());
|
||||
|
@ -8780,7 +8780,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