diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-18 12:44:52 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-18 12:46:32 +0000 |
commit | 1d62855044eed34f0184a468b90d63414c2a9ebc (patch) | |
tree | ec6d4a08133334d47a26c4d6593dba1e07795667 /src | |
parent | Merge pull request #5155 (diff) | |
download | monero-1d62855044eed34f0184a468b90d63414c2a9ebc.tar.xz |
blockchain: fix long term weight addition on pop/init
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index ba9351f4f..343bec330 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -512,7 +512,8 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline const uint64_t nblocks = std::min<uint64_t>(m_long_term_block_weights.capacity(), db_height); while (m_long_term_block_weights.size() < nblocks) { - m_long_term_block_weights.push_front(db_height - 1 - m_long_term_block_weights.size()); + uint64_t weight = m_db->get_block_long_term_weight(db_height - 1 - m_long_term_block_weights.size()); + m_long_term_block_weights.push_front(weight); } m_long_term_block_weights_height = db_height; @@ -3646,7 +3647,8 @@ void Blockchain::pop_from_long_term_block_weights() if (m_long_term_block_weights_height + 1 > m_long_term_block_weights.capacity()) { uint64_t block_height = m_long_term_block_weights_height - m_long_term_block_weights.capacity() + 1; - m_long_term_block_weights.push_front(block_height); + uint64_t weight = m_db->get_block_long_term_weight(block_height); + m_long_term_block_weights.push_front(weight); } } //------------------------------------------------------------------ |