@@ -1544,7 +1544,7 @@ uint64_t Blockchain::get_current_cumulative_block_weight_median() const
1544
1544
// in a lot of places. That flag is not referenced in any of the code
1545
1545
// nor any of the makefiles, howeve. Need to look into whether or not it's
1546
1546
// necessary at all.
1547
- bool Blockchain::create_block_template (block& b, const crypto::hash *from_block, const account_public_address& miner_address, difficulty_type& diffic, uint64_t & height, uint64_t & expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash)
1547
+ bool Blockchain::create_block_template (block& b, const crypto::hash *from_block, const account_public_address& miner_address, difficulty_type& diffic, uint64_t & height, uint64_t & expected_reward, uint64_t & cumulative_weight, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash)
1548
1548
{
1549
1549
LOG_PRINT_L3 (" Blockchain::" << __func__);
1550
1550
size_t median_weight;
@@ -1571,6 +1571,7 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
1571
1571
diffic = m_btc_difficulty;
1572
1572
height = m_btc_height;
1573
1573
expected_reward = m_btc_expected_reward;
1574
+ cumulative_weight = m_btc_cumulative_weight;
1574
1575
seed_height = m_btc_seed_height;
1575
1576
seed_hash = m_btc_seed_hash;
1576
1577
return true ;
@@ -1754,7 +1755,7 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
1754
1755
size_t max_outs = hf_version >= 4 ? 1 : 11 ;
1755
1756
bool r = construct_miner_tx (height, median_weight, already_generated_coins, txs_weight, fee, miner_address, b.miner_tx , ex_nonce, max_outs, hf_version);
1756
1757
CHECK_AND_ASSERT_MES (r, false , " Failed to construct miner tx, first chance" );
1757
- size_t cumulative_weight = txs_weight + get_transaction_weight (b.miner_tx );
1758
+ cumulative_weight = txs_weight + get_transaction_weight (b.miner_tx );
1758
1759
#if defined(DEBUG_CREATE_BLOCK_TEMPLATE)
1759
1760
MDEBUG (" Creating block template: miner tx weight " << get_transaction_weight (b.miner_tx ) <<
1760
1761
" , cumulative weight " << cumulative_weight);
@@ -1806,16 +1807,16 @@ bool Blockchain::create_block_template(block& b, const crypto::hash *from_block,
1806
1807
#endif
1807
1808
1808
1809
if (!from_block)
1809
- cache_block_template (b, miner_address, ex_nonce, diffic, height, expected_reward, seed_height, seed_hash, pool_cookie);
1810
+ cache_block_template (b, miner_address, ex_nonce, diffic, height, expected_reward, cumulative_weight, seed_height, seed_hash, pool_cookie);
1810
1811
return true ;
1811
1812
}
1812
1813
LOG_ERROR (" Failed to create_block_template with " << 10 << " tries" );
1813
1814
return false ;
1814
1815
}
1815
1816
// ------------------------------------------------------------------
1816
- bool Blockchain::create_block_template (block& b, const account_public_address& miner_address, difficulty_type& diffic, uint64_t & height, uint64_t & expected_reward, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash)
1817
+ bool Blockchain::create_block_template (block& b, const account_public_address& miner_address, difficulty_type& diffic, uint64_t & height, uint64_t & expected_reward, uint64_t & cumulative_weight, const blobdata& ex_nonce, uint64_t &seed_height, crypto::hash &seed_hash)
1817
1818
{
1818
- return create_block_template (b, NULL , miner_address, diffic, height, expected_reward, ex_nonce, seed_height, seed_hash);
1819
+ return create_block_template (b, NULL , miner_address, diffic, height, expected_reward, cumulative_weight, ex_nonce, seed_height, seed_hash);
1819
1820
}
1820
1821
// ------------------------------------------------------------------
1821
1822
bool Blockchain::get_miner_data (uint8_t & major_version, uint64_t & height, crypto::hash& prev_id, crypto::hash& seed_hash, difficulty_type& difficulty, uint64_t & median_weight, uint64_t & already_generated_coins, std::vector<tx_block_template_backlog_entry>& tx_backlog)
@@ -5607,7 +5608,7 @@ void Blockchain::invalidate_block_template_cache()
5607
5608
m_btc_valid = false ;
5608
5609
}
5609
5610
5610
- void Blockchain::cache_block_template (const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t seed_height, const crypto::hash &seed_hash, uint64_t pool_cookie)
5611
+ void Blockchain::cache_block_template (const block &b, const cryptonote::account_public_address &address, const blobdata &nonce, const difficulty_type &diff, uint64_t height, uint64_t expected_reward, uint64_t cumulative_weight, uint64_t seed_height, const crypto::hash &seed_hash, uint64_t pool_cookie)
5611
5612
{
5612
5613
MDEBUG (" Setting block template cache" );
5613
5614
m_btc = b;
@@ -5616,6 +5617,7 @@ void Blockchain::cache_block_template(const block &b, const cryptonote::account_
5616
5617
m_btc_difficulty = diff;
5617
5618
m_btc_height = height;
5618
5619
m_btc_expected_reward = expected_reward;
5620
+ m_btc_cumulative_weight = cumulative_weight;
5619
5621
m_btc_seed_hash = seed_hash;
5620
5622
m_btc_seed_height = seed_height;
5621
5623
m_btc_pool_cookie = pool_cookie;
0 commit comments