aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-17 21:39:44 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-17 21:39:44 +0200
commit4466b6d1b08d827f3bdddb1cab8ca05833b65437 (patch)
tree3e86342c3194fddb5fac2b5f51b33bcf55ec887a /src/cryptonote_core
parentMerge pull request #2301 (diff)
parentcryptonote_protocol: large block sync size before v4 (diff)
downloadmonero-4466b6d1b08d827f3bdddb1cab8ca05833b65437.tar.xz
Merge pull request #2303
5a283078 cryptonote_protocol: large block sync size before v4 (moneromooo-monero) 7b747607 cryptonote_protocol: kick idle synchronizing peers (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp12
-rw-r--r--src/cryptonote_core/cryptonote_core.h2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 430d66e21..19f4aaca9 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -421,8 +421,6 @@ namespace cryptonote
CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage");
block_sync_size = command_line::get_arg(vm, command_line::arg_block_sync_size);
- if (block_sync_size == 0)
- block_sync_size = BLOCKS_SYNCHRONIZING_DEFAULT_COUNT;
MGINFO("Loading checkpoints");
@@ -788,6 +786,16 @@ namespace cryptonote
return true;
}
//-----------------------------------------------------------------------------------------------
+ size_t core::get_block_sync_size(uint64_t height) const
+ {
+ static const uint64_t quick_height = m_testnet ? 801219 : 1220516;
+ if (block_sync_size > 0)
+ return block_sync_size;
+ if (height >= quick_height)
+ return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT;
+ return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4;
+ }
+ //-----------------------------------------------------------------------------------------------
std::pair<uint64_t, uint64_t> core::get_coinbase_tx_sum(const uint64_t start_offset, const size_t count)
{
uint64_t emission_amount = 0;
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index 3c66d772d..f17a6dfe6 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -698,7 +698,7 @@ namespace cryptonote
*
* @return the number of blocks to sync in one go
*/
- size_t get_block_sync_size() const { return block_sync_size; }
+ size_t get_block_sync_size(uint64_t height) const;
/**
* @brief get the sum of coinbase tx amounts between blocks