mirror of
https://github.com/wownero/wownero.git
synced 2026-10-20 17:08:35 +02:00
src: reduce unnecessary copies/allocations
This commit is contained in:
@@ -3736,6 +3736,7 @@ bool Blockchain::check_tx_input(size_t tx_version, const txin_to_key& txin, cons
|
|||||||
};
|
};
|
||||||
|
|
||||||
output_keys.clear();
|
output_keys.clear();
|
||||||
|
output_keys.reserve(txin.key_offsets.size());
|
||||||
|
|
||||||
// collect output keys
|
// collect output keys
|
||||||
outputs_visitor vi(output_keys, *this, hf_version);
|
outputs_visitor vi(output_keys, *this, hf_version);
|
||||||
@@ -4291,7 +4292,7 @@ leave:
|
|||||||
{
|
{
|
||||||
uint64_t long_term_block_weight = get_next_long_term_block_weight(block_weight);
|
uint64_t long_term_block_weight = get_next_long_term_block_weight(block_weight);
|
||||||
cryptonote::blobdata bd = cryptonote::block_to_blob(bl);
|
cryptonote::blobdata bd = cryptonote::block_to_blob(bl);
|
||||||
new_height = m_db->add_block(std::make_pair(std::move(bl), std::move(bd)), block_weight, long_term_block_weight, cumulative_difficulty, already_generated_coins, txs);
|
new_height = m_db->add_block(std::make_pair(bl, std::move(bd)), block_weight, long_term_block_weight, cumulative_difficulty, already_generated_coins, txs);
|
||||||
}
|
}
|
||||||
catch (const KEY_IMAGE_EXISTS& e)
|
catch (const KEY_IMAGE_EXISTS& e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1777,9 +1777,10 @@ namespace cryptonote
|
|||||||
const uint32_t max_nonce = restricted ? 16384 : 65535;
|
const uint32_t max_nonce = restricted ? 16384 : 65535;
|
||||||
bool collision = true;
|
bool collision = true;
|
||||||
std::vector<uint32_t> slots(aux_pow.size());
|
std::vector<uint32_t> slots(aux_pow.size());
|
||||||
|
std::vector<bool> slot_seen(aux_pow.size(), false);
|
||||||
for (nonce = 0; nonce <= max_nonce; ++nonce)
|
for (nonce = 0; nonce <= max_nonce; ++nonce)
|
||||||
{
|
{
|
||||||
std::vector<bool> slot_seen(aux_pow.size(), false);
|
slot_seen.assign(aux_pow.size(), false);
|
||||||
collision = false;
|
collision = false;
|
||||||
for (size_t idx = 0; idx < aux_pow.size(); ++idx)
|
for (size_t idx = 0; idx < aux_pow.size(); ++idx)
|
||||||
slots[idx] = 0xffffffff;
|
slots[idx] = 0xffffffff;
|
||||||
|
|||||||
Reference in New Issue
Block a user