mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
Merge pull request #4869
60f36386
Avoid unnecessary temp block and copy ctor (moneromooo-monero)
This commit is contained in:
commit
e7d30780de
@ -147,7 +147,7 @@ namespace cryptonote
|
|||||||
//-----------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------
|
||||||
bool miner::request_block_template()
|
bool miner::request_block_template()
|
||||||
{
|
{
|
||||||
block bl = AUTO_VAL_INIT(bl);
|
block bl;
|
||||||
difficulty_type di = AUTO_VAL_INIT(di);
|
difficulty_type di = AUTO_VAL_INIT(di);
|
||||||
uint64_t height = AUTO_VAL_INIT(height);
|
uint64_t height = AUTO_VAL_INIT(height);
|
||||||
uint64_t expected_reward; //only used for RPC calls - could possibly be useful here too?
|
uint64_t expected_reward; //only used for RPC calls - could possibly be useful here too?
|
||||||
|
@ -404,7 +404,7 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline
|
|||||||
if(!m_db->height())
|
if(!m_db->height())
|
||||||
{
|
{
|
||||||
MINFO("Blockchain not loaded, generating genesis block.");
|
MINFO("Blockchain not loaded, generating genesis block.");
|
||||||
block bl = boost::value_initialized<block>();
|
block bl;
|
||||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||||
generate_genesis_block(bl, get_config(m_nettype).GENESIS_TX, get_config(m_nettype).GENESIS_NONCE);
|
generate_genesis_block(bl, get_config(m_nettype).GENESIS_TX, get_config(m_nettype).GENESIS_NONCE);
|
||||||
add_new_block(bl, bvc);
|
add_new_block(bl, bvc);
|
||||||
|
@ -1078,7 +1078,7 @@ namespace cryptonote
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
block b = AUTO_VAL_INIT(b);
|
block b;
|
||||||
cryptonote::blobdata blob_reserve;
|
cryptonote::blobdata blob_reserve;
|
||||||
blob_reserve.resize(req.reserve_size, 0);
|
blob_reserve.resize(req.reserve_size, 0);
|
||||||
if(!m_core.get_block_template(b, info.address, res.difficulty, res.height, res.expected_reward, blob_reserve))
|
if(!m_core.get_block_template(b, info.address, res.difficulty, res.height, res.expected_reward, blob_reserve))
|
||||||
@ -1149,7 +1149,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
// Fixing of high orphan issue for most pools
|
// Fixing of high orphan issue for most pools
|
||||||
// Thanks Boolberry!
|
// Thanks Boolberry!
|
||||||
block b = AUTO_VAL_INIT(b);
|
block b;
|
||||||
if(!parse_and_validate_block_from_blob(blockblob, b))
|
if(!parse_and_validate_block_from_blob(blockblob, b))
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB;
|
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB;
|
||||||
@ -1217,7 +1217,7 @@ namespace cryptonote
|
|||||||
error_resp.message = "Wrong block blob";
|
error_resp.message = "Wrong block blob";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
block b = AUTO_VAL_INIT(b);
|
block b;
|
||||||
if(!parse_and_validate_block_from_blob(blockblob, b))
|
if(!parse_and_validate_block_from_blob(blockblob, b))
|
||||||
{
|
{
|
||||||
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB;
|
error_resp.code = CORE_RPC_ERROR_CODE_WRONG_BLOCKBLOB;
|
||||||
|
Loading…
Reference in New Issue
Block a user