diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-11-05 21:35:51 -0500 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2015-01-04 19:39:40 -0800 |
commit | 6c8b8acfe45f8b2f20df48fed88ea074a26d653f (patch) | |
tree | 9ef8538bfb6e7ac9208cdc8a3acc2d83be2e1d66 | |
parent | ~ didn't work, need hard path. debug print. (diff) | |
download | monero-6c8b8acfe45f8b2f20df48fed88ea074a26d653f.tar.xz |
more blockchain height-related fixes, syncing other nodes code this time
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 03eac11d4..21ec14d3e 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1631,7 +1631,7 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& qbloc resp.total_height = get_current_blockchain_height(); size_t count = 0; - for(size_t i = resp.start_height; i <= m_db->height() && count < BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT; i++, count++) + for(size_t i = resp.start_height; i < resp.total_height && count < BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT; i++, count++) { resp.m_block_ids.push_back(m_db->get_block_hash_from_height(i)); } @@ -1651,7 +1651,7 @@ bool Blockchain::find_blockchain_supplement(const uint64_t req_start_block, cons if(req_start_block > 0) { // if requested height is higher than our chain, return false -- we can't help - if (req_start_block > m_db->height()) + if (req_start_block >= m_db->height()) { return false; } @@ -1667,12 +1667,12 @@ bool Blockchain::find_blockchain_supplement(const uint64_t req_start_block, cons total_height = get_current_blockchain_height(); size_t count = 0; - for(size_t i = start_height; i <= m_db->height() && count < max_count; i++, count++) + for(size_t i = start_height; i < total_height && count < max_count; i++, count++) { blocks.resize(blocks.size()+1); blocks.back().first = m_db->get_block_from_height(i); std::list<crypto::hash> mis; - get_transactions(m_blocks[i].bl.tx_hashes, blocks.back().second, mis); + get_transactions(blocks.back().first.tx_hashes, blocks.back().second, mis); CHECK_AND_ASSERT_MES(!mis.size(), false, "internal error, transaction from block not found"); } return true; |