aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--cmake/Version.cmake2
-rw-r--r--src/cryptonote_core/blockchain.cpp47
-rw-r--r--src/daemon/rpc_command_executor.cpp1
-rw-r--r--tests/unit_tests/CMakeLists.txt2
-rw-r--r--tests/unit_tests/main.cpp11
6 files changed, 59 insertions, 9 deletions
diff --git a/README.md b/README.md
index 9964cc4a7..a11f3e0a1 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,11 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
- Our [Vulnerability Response Process](https://github.com/monero-project/meta/blob/master/VULNERABILITY_RESPONSE_PROCESS.md) encourages responsible disclosure
- We are also available via [HackerOne](https://hackerone.com/monero)
+
+## Announcements
+
+You can subscribe to an [announcement listserv](https://lists.getmonero.org) to get critical announcements from the Monero core team. The announcement list can be very helpful for knowing when software updates are needed.
+
## Build
| Operating System | Processor | Status |
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
index 439c4c5ae..3677e80d7 100644
--- a/cmake/Version.cmake
+++ b/cmake/Version.cmake
@@ -28,7 +28,7 @@
function (write_static_version_header hash)
set(VERSIONTAG "${hash}")
- configure_file("src/version.cpp.in" "version.cpp")
+ configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
endfunction ()
find_package(Git QUIET)
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index d1a65a067..d1ef7d6fe 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -441,6 +441,53 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline
MINFO("Blockchain initialized. last block: " << m_db->height() - 1 << ", " << epee::misc_utils::get_time_interval_string(timestamp_diff) << " time ago, current difficulty: " << get_difficulty_for_next_block());
m_db->block_txn_stop();
+ uint64_t num_popped_blocks = 0;
+ while (true)
+ {
+ const uint64_t top_height = m_db->height() - 1;
+ const crypto::hash top_id = m_db->top_block_hash();
+ const block top_block = m_db->get_top_block();
+ const uint8_t ideal_hf_version = get_ideal_hard_fork_version(top_height);
+ if (ideal_hf_version <= 1 || ideal_hf_version == top_block.major_version)
+ {
+ if (num_popped_blocks > 0)
+ MGINFO("Initial popping done, top block: " << top_id << ", top height: " << top_height << ", block version: " << (uint64_t)top_block.major_version);
+ break;
+ }
+ else
+ {
+ if (num_popped_blocks == 0)
+ MGINFO("Current top block " << top_id << " at height " << top_height << " has version " << (uint64_t)top_block.major_version << " which disagrees with the ideal version " << (uint64_t)ideal_hf_version);
+ if (num_popped_blocks % 100 == 0)
+ MGINFO("Popping blocks... " << top_height);
+ ++num_popped_blocks;
+ block popped_block;
+ std::vector<transaction> popped_txs;
+ try
+ {
+ m_db->pop_block(popped_block, popped_txs);
+ }
+ // anything that could cause this to throw is likely catastrophic,
+ // so we re-throw
+ catch (const std::exception& e)
+ {
+ MERROR("Error popping block from blockchain: " << e.what());
+ throw;
+ }
+ catch (...)
+ {
+ MERROR("Error popping block from blockchain, throwing!");
+ throw;
+ }
+ }
+ }
+ if (num_popped_blocks > 0)
+ {
+ m_timestamps_and_difficulties_height = 0;
+ m_hardfork->reorganize_from_chain_height(get_current_blockchain_height());
+ m_tx_pool.on_blockchain_dec(m_db->height()-1, get_tail_id());
+ }
+
update_next_cumulative_size_limit();
return true;
}
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 64ce3a406..2efb501ea 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -720,6 +720,7 @@ bool t_rpc_command_executor::print_transaction(crypto::hash transaction_hash,
req.txs_hashes.push_back(epee::string_tools::pod_to_hex(transaction_hash));
req.decode_as_json = false;
+ req.prune = false;
if (m_is_rpc)
{
if (!m_rpc_client->rpc_request(req, res, "/gettransactions", fail_message.c_str()))
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index 9c58536c9..249dbdbe8 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -103,6 +103,8 @@ if (NOT MSVC)
COMPILE_FLAGS " -Wno-undef -Wno-sign-compare")
endif ()
+SET_PROPERTY(SOURCE main.cpp PROPERTY COMPILE_FLAGS -DDEFAULT_DATA_DIR="\\"${CMAKE_SOURCE_DIR}/tests/data\\"")
+
SET_PROPERTY(SOURCE memwipe.cpp PROPERTY COMPILE_FLAGS -Ofast)
add_test(
diff --git a/tests/unit_tests/main.cpp b/tests/unit_tests/main.cpp
index 85c6cbed5..13b62cbb4 100644
--- a/tests/unit_tests/main.cpp
+++ b/tests/unit_tests/main.cpp
@@ -61,8 +61,8 @@ int main(int argc, char** argv)
::testing::InitGoogleTest(&argc, argv);
po::options_description desc_options("Command line options");
- const command_line::arg_descriptor<std::string> arg_data_dir = { "data-dir", "Data files directory" };
- command_line::add_arg(desc_options, arg_data_dir, "");
+ const command_line::arg_descriptor<std::string> arg_data_dir = { "data-dir", "Data files directory", DEFAULT_DATA_DIR };
+ command_line::add_arg(desc_options, arg_data_dir);
po::variables_map vm;
bool r = command_line::handle_error_helper(desc_options, [&]()
@@ -74,12 +74,7 @@ int main(int argc, char** argv)
if (! r)
return 1;
- if (command_line::is_arg_defaulted(vm, arg_data_dir))
- unit_test::data_dir = boost::filesystem::canonical(boost::filesystem::path(epee::string_tools::get_current_module_folder()))
- .parent_path().parent_path().parent_path().parent_path()
- .append("tests").append("data");
- else
- unit_test::data_dir = command_line::get_arg(vm, arg_data_dir);
+ unit_test::data_dir = command_line::get_arg(vm, arg_data_dir);
return RUN_ALL_TESTS();
}