diff options
author | Riccardo Spagni <ric@spagni.net> | 2015-10-20 20:55:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2015-10-20 20:55:53 +0200 |
commit | 14dd279fe123d7b48baed82d9109c585839b678f (patch) | |
tree | a79e281f205a0578312aa3b7cfc9a488036b9078 /src/cryptonote_core/blockchain.cpp | |
parent | Merge pull request #432 (diff) | |
parent | blockchain_export can now export to a blocks.dat format (diff) | |
download | monero-14dd279fe123d7b48baed82d9109c585839b678f.tar.xz |
Merge pull request #437
b13e7f2 blockchain_export can now export to a blocks.dat format (moneromooo-monero)
11db442 bootstrap_file: do not try to create a directory with an empty name (moneromooo-monero)
03bc610 hardfork: use DB transactions when reorganizing (moneromooo-monero)
439c455 hardfork: simplify work done on reload (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index e06c3c08c..c38b58841 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -352,13 +352,14 @@ bool Blockchain::init(BlockchainDB* db, const bool testnet) m_async_pool.create_thread(boost::bind(&boost::asio::io_service::run, &m_async_service)); #if defined(PER_BLOCK_CHECKPOINT) - if (m_fast_sync && !testnet && get_blocks_dat_start() != nullptr) + if (m_fast_sync && get_blocks_dat_start(testnet) != nullptr) { - if (get_blocks_dat_size() > 4) + if (get_blocks_dat_size(testnet) > 4) { - const unsigned char *p = get_blocks_dat_start(); - uint32_t nblocks = *(uint32_t *) p; - if(nblocks > 0 && nblocks > m_db->height()) + const unsigned char *p = get_blocks_dat_start(testnet); + const uint32_t nblocks = *p | ((*(p+1))<<8) | ((*(p+2))<<16) | ((*(p+3))<<24); + const size_t size_needed = 4 + nblocks * sizeof(crypto::hash); + if(nblocks > 0 && nblocks > m_db->height() && get_blocks_dat_size(testnet) >= size_needed) { LOG_PRINT_L0("Loading precomputed blocks: " << nblocks); p += sizeof(uint32_t); |