aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md19
-rw-r--r--cmake/Version.cmake6
-rw-r--r--src/cryptonote_config.h3
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp3
-rw-r--r--src/p2p/net_node.inl6
-rw-r--r--src/simplewallet/simplewallet.cpp3
-rw-r--r--src/wallet/wallet2.cpp83
-rw-r--r--src/wallet/wallet2.h2
8 files changed, 89 insertions, 36 deletions
diff --git a/README.md b/README.md
index 114afcd4e..db1daf4c3 100644
--- a/README.md
+++ b/README.md
@@ -86,9 +86,9 @@ See [LICENSE](LICENSE).
If you want to help out, see [CONTRIBUTING](CONTRIBUTING.md) for a set of guidelines.
-## Scheduled mandatory software upgrades
+## Scheduled software upgrades
-Monero uses a fixed-schedule mandatory software upgrade (hard fork) mechanism to implement new features. This means that users of Monero (end users and service providers) need to run current versions and upgrade their software on a regular schedule. Mandatory software upgrades occur during the months of March and September. The required software for these upgrades will be available prior to the scheduled date. Please check the repository prior to this date for the proper Monero software version. Below is the historical schedule and the projected schedule for the next upgrade.
+Monero uses a fixed-schedule software upgrade (hard fork) mechanism to implement new features. This means that users of Monero (end users and service providers) should run current versions and upgrade their software on a regular schedule. Software upgrades occur during the months of April and October. The required software for these upgrades will be available prior to the scheduled date. Please check the repository prior to this date for the proper Monero software version. Below is the historical schedule and the projected schedule for the next upgrade.
Dates are provided in the format YYYY-MM-DD.
@@ -100,12 +100,13 @@ Dates are provided in the format YYYY-MM-DD.
| 1288616 | 2017-04-15 | v5 | v0.10.3.0 | v0.10.3.1 | Adjusted minimum blocksize and fee algorithm |
| 1400000 | 2017-09-16 | v6 | v0.11.0.0 | v0.11.0.0 | Allow only RingCT transactions, allow only >= ringsize 5 |
| 1546000 | 2018-04-06 | v7 | v0.12.0.0 | v0.12.0.0 | Cryptonight variant 1, ringsize >= 7, sorted inputs
+| XXXXXXX | 2018-10-XX | XX | XXXXXXXXX | XXXXXXXXX | X
X's indicate that these details have not been determined as of commit date.
## Release staging schedule and protocol
-Approximately three months prior to a scheduled mandatory software upgrade, a branch from Master will be created with the new release version tag. Pull requests that address bugs should then be made to both Master and the new release branch. Pull requests that require extensive review and testing (generally, optimizations and new features) should *not* be made to the release branch.
+Approximately three months prior to a scheduled software upgrade, a branch from Master will be created with the new release version tag. Pull requests that address bugs should then be made to both Master and the new release branch. Pull requests that require extensive review and testing (generally, optimizations and new features) should *not* be made to the release branch.
## Installing Monero from a package
@@ -166,7 +167,7 @@ library archives (`.a`).
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Fedora | Optional | Purpose |
| ------------ | ------------- | -------- | ------------------ | ------------ | ----------------- | -------- | -------------- |
| GCC | 4.7.3 | NO | `build-essential` | `base-devel` | `gcc` | NO | |
-| CMake | 3.2.0 | NO | `cmake` | `cmake` | `cmake` | NO | |
+| CMake | 3.0.0 | NO | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | NO | C++ libraries |
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | NO | sha256 sum |
@@ -187,6 +188,16 @@ library archives (`.a`).
[^] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must
build the library binary manually. This can be done with the following command ```sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ ```
+### Cloning the repository
+
+Clone recursively to pull-in needed submodule(s):
+
+`$ git clone --recursive https://github.com/monero-project/monero`
+
+If you already have a repo cloned, initialize and update:
+
+`$ cd monero && git submodule init && git submodule update`
+
### Build instructions
Monero uses the CMake build system and a top-level [Makefile](Makefile) that
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
index 63b2a6790..439c4c5ae 100644
--- a/cmake/Version.cmake
+++ b/cmake/Version.cmake
@@ -37,14 +37,16 @@ if ("$Format:$" STREQUAL "")
write_static_version_header("release")
elseif (GIT_FOUND OR Git_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
- add_custom_target(genversion ALL
+ add_custom_command(
+ OUTPUT "${CMAKE_BINARY_DIR}/version.cpp"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
"-P" "cmake/GenVersion.cmake"
- BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
else()
message(STATUS "WARNING: Git was not found!")
write_static_version_header("unknown")
endif ()
+add_custom_target(genversion ALL
+ DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
index 0ad8a6005..3e64073dd 100644
--- a/src/cryptonote_config.h
+++ b/src/cryptonote_config.h
@@ -200,6 +200,7 @@ namespace cryptonote
MAINNET = 0,
TESTNET,
STAGENET,
- FAKECHAIN
+ FAKECHAIN,
+ UNDEFINED = 255
};
}
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index adccd0469..e4a4cb2f1 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -171,7 +171,8 @@ namespace cryptonote
m_last_json_checkpoints_update(0),
m_disable_dns_checkpoints(false),
m_threadpool(tools::threadpool::getInstance()),
- m_update_download(0)
+ m_update_download(0),
+ m_nettype(UNDEFINED)
{
m_checkpoints_updating.clear();
set_cryptonote_protocol(pprotocol);
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 54875e619..3b0d1c394 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -397,8 +397,8 @@ namespace nodetool
full_addrs.insert("163.172.182.165:18080");
full_addrs.insert("161.67.132.39:18080");
full_addrs.insert("198.74.231.92:18080");
- full_addrs.insert("195.154.123.123:28080");
- full_addrs.insert("212.83.172.165:28080");
+ full_addrs.insert("195.154.123.123:18080");
+ full_addrs.insert("212.83.172.165:18080");
}
return full_addrs;
}
@@ -490,7 +490,7 @@ namespace nodetool
if (result.size())
{
for (const auto& addr_string : result)
- full_addrs.insert(addr_string + ":18080");
+ full_addrs.insert(addr_string + ":" + std::to_string(m_nettype == cryptonote::TESTNET ? ::config::testnet::P2P_DEFAULT_PORT : m_nettype == cryptonote::STAGENET ? ::config::stagenet::P2P_DEFAULT_PORT : ::config::P2P_DEFAULT_PORT));
}
++i;
}
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 97dadb126..4e06c4692 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -3101,6 +3101,9 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!m_trusted_daemon)
message_writer() << (boost::format(tr("Warning: using an untrusted daemon at %s, privacy will be lessened")) % m_wallet->get_daemon_address()).str();
+ if (m_wallet->get_ring_database().empty())
+ fail_msg_writer() << tr("Failed to initialize ring database: privacy enhancing features will be inactive");
+
m_wallet->callback(this);
return true;
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 4b7e6dd93..7c9a66c26 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -2669,6 +2669,9 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_
m_confirm_backlog_threshold = 0;
m_confirm_export_overwrite = true;
m_auto_low_priority = true;
+ m_segregate_pre_fork_outputs = true;
+ m_key_reuse_mitigation2 = true;
+ m_segregation_height = 0;
m_key_on_device = false;
}
else if(json.IsObject())
@@ -2785,6 +2788,12 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_
(boost::format("%s wallet cannot be opened as %s wallet")
% (field_nettype == 0 ? "Mainnet" : field_nettype == 1 ? "Testnet" : "Stagenet")
% (m_nettype == MAINNET ? "mainnet" : m_nettype == TESTNET ? "testnet" : "stagenet")).str());
+ GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, segregate_pre_fork_outputs, int, Int, false, true);
+ m_segregate_pre_fork_outputs = field_segregate_pre_fork_outputs;
+ GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, key_reuse_mitigation2, int, Int, false, true);
+ m_key_reuse_mitigation2 = field_key_reuse_mitigation2;
+ GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, segregation_height, int, Uint, false, 0);
+ m_segregation_height = field_segregation_height;
}
else
{
@@ -5467,29 +5476,43 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<crypto
}
}
-void wallet2::set_ring_database(const std::string &filename)
+bool wallet2::set_ring_database(const std::string &filename)
{
m_ring_database = filename;
MINFO("ringdb path set to " << filename);
m_ringdb.reset();
- cryptonote::block b;
- generate_genesis(b);
if (!m_ring_database.empty())
- m_ringdb.reset(new tools::ringdb(m_ring_database, epee::string_tools::pod_to_hex(get_block_hash(b))));
+ {
+ try
+ {
+ cryptonote::block b;
+ generate_genesis(b);
+ m_ringdb.reset(new tools::ringdb(m_ring_database, epee::string_tools::pod_to_hex(get_block_hash(b))));
+ }
+ catch (const std::exception &e)
+ {
+ MERROR("Failed to initialize ringdb: " << e.what());
+ m_ring_database = "";
+ return false;
+ }
+ }
+ return true;
}
bool wallet2::add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx)
{
if (!m_ringdb)
return true;
- return m_ringdb->add_rings(key, tx);
+ try { return m_ringdb->add_rings(key, tx); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::add_rings(const cryptonote::transaction_prefix &tx)
{
crypto::chacha_key key;
generate_chacha_key_from_secret_keys(key);
- return add_rings(key, tx);
+ try { return add_rings(key, tx); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::remove_rings(const cryptonote::transaction_prefix &tx)
@@ -5498,14 +5521,16 @@ bool wallet2::remove_rings(const cryptonote::transaction_prefix &tx)
return true;
crypto::chacha_key key;
generate_chacha_key_from_secret_keys(key);
- return m_ringdb->remove_rings(key, tx);
+ try { return m_ringdb->remove_rings(key, tx); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector<uint64_t> &outs)
{
if (!m_ringdb)
return true;
- return m_ringdb->get_ring(key, key_image, outs);
+ try { return m_ringdb->get_ring(key, key_image, outs); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::get_rings(const crypto::hash &txid, std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &outs)
@@ -5536,7 +5561,8 @@ bool wallet2::get_ring(const crypto::key_image &key_image, std::vector<uint64_t>
crypto::chacha_key key;
generate_chacha_key_from_secret_keys(key);
- return get_ring(key, key_image, outs);
+ try { return get_ring(key, key_image, outs); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::set_ring(const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative)
@@ -5547,7 +5573,8 @@ bool wallet2::set_ring(const crypto::key_image &key_image, const std::vector<uin
crypto::chacha_key key;
generate_chacha_key_from_secret_keys(key);
- return m_ringdb->set_ring(key, key_image, outs, relative);
+ try { return m_ringdb->set_ring(key, key_image, outs, relative); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::find_and_save_rings(bool force)
@@ -5615,33 +5642,40 @@ bool wallet2::blackball_output(const crypto::public_key &output)
{
if (!m_ringdb)
return true;
- return m_ringdb->blackball(output);
+ try { return m_ringdb->blackball(output); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::set_blackballed_outputs(const std::vector<crypto::public_key> &outputs, bool add)
{
if (!m_ringdb)
return true;
- bool ret = true;
- if (!add)
- ret &= m_ringdb->clear_blackballs();
- for (const auto &output: outputs)
- ret &= m_ringdb->blackball(output);
- return ret;
+ try
+ {
+ bool ret = true;
+ if (!add)
+ ret &= m_ringdb->clear_blackballs();
+ for (const auto &output: outputs)
+ ret &= m_ringdb->blackball(output);
+ return ret;
+ }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::unblackball_output(const crypto::public_key &output)
{
if (!m_ringdb)
return true;
- return m_ringdb->unblackball(output);
+ try { return m_ringdb->unblackball(output); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::is_output_blackballed(const crypto::public_key &output) const
{
if (!m_ringdb)
return true;
- return m_ringdb->blackballed(output);
+ try { return m_ringdb->blackballed(output); }
+ catch (const std::exception &e) { return false; }
}
bool wallet2::tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, uint64_t global_index, const crypto::public_key& output_public_key, const rct::key& mask, uint64_t real_index, bool unlocked) const
@@ -5785,6 +5819,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
throw_on_rpc_response_error(result, "get_info");
bool is_shortly_after_segregation_fork = height >= segregation_fork_height && height < segregation_fork_height + SEGREGATION_FORK_VICINITY;
+ bool is_after_segregation_fork = height >= segregation_fork_height;
// get histogram for the amounts we need
cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request req_t = AUTO_VAL_INIT(req_t);
@@ -5805,7 +5840,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
// if we want to segregate fake outs pre or post fork, get distribution
std::unordered_map<uint64_t, std::pair<uint64_t, uint64_t>> segregation_limit;
- if (m_segregate_pre_fork_outputs || m_key_reuse_mitigation2)
+ if (is_after_segregation_fork && (m_segregate_pre_fork_outputs || m_key_reuse_mitigation2))
{
cryptonote::COMMAND_RPC_GET_OUTPUT_DISTRIBUTION::request req_t = AUTO_VAL_INIT(req_t);
cryptonote::COMMAND_RPC_GET_OUTPUT_DISTRIBUTION::response resp_t = AUTO_VAL_INIT(resp_t);
@@ -5814,7 +5849,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
std::sort(req_t.amounts.begin(), req_t.amounts.end());
auto end = std::unique(req_t.amounts.begin(), req_t.amounts.end());
req_t.amounts.resize(std::distance(req_t.amounts.begin(), end));
- req_t.from_height = segregation_fork_height >= RECENT_OUTPUT_ZONE ? height >= (segregation_fork_height ? segregation_fork_height : height) - RECENT_OUTPUT_BLOCKS : 0;
+ req_t.from_height = std::max<uint64_t>(segregation_fork_height, RECENT_OUTPUT_BLOCKS) - RECENT_OUTPUT_BLOCKS;
req_t.cumulative = true;
m_daemon_rpc_mutex.lock();
bool r = net_utils::invoke_http_json_rpc("/json_rpc", "get_output_distribution", req_t, resp_t, m_http_client, rpc_timeout);
@@ -5872,7 +5907,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
float pre_fork_num_out_ratio = 0.0f;
float post_fork_num_out_ratio = 0.0f;
- if (m_segregate_pre_fork_outputs && output_is_pre_fork)
+ if (is_after_segregation_fork && m_segregate_pre_fork_outputs && output_is_pre_fork)
{
num_outs = segregation_limit[amount].first;
num_recent_outs = segregation_limit[amount].second;
@@ -5892,7 +5927,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
break;
}
}
- if (m_key_reuse_mitigation2)
+ if (is_after_segregation_fork && m_key_reuse_mitigation2)
{
if (output_is_pre_fork)
{
@@ -6107,7 +6142,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
uint64_t num_outs = 0;
const uint64_t amount = td.is_rct() ? 0 : td.amount();
const bool output_is_pre_fork = td.m_block_height < segregation_fork_height;
- if (m_segregate_pre_fork_outputs && output_is_pre_fork)
+ if (is_after_segregation_fork && m_segregate_pre_fork_outputs && output_is_pre_fork)
num_outs = segregation_limit[amount].first;
else for (const auto &he: resp_t.histogram)
{
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index abc7bb538..ca8bee965 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -1061,7 +1061,7 @@ namespace tools
return epee::net_utils::invoke_http_json_rpc(uri, method_name, req, res, m_http_client, timeout, http_method, req_id);
}
- void set_ring_database(const std::string &filename);
+ bool set_ring_database(const std::string &filename);
const std::string get_ring_database() const { return m_ring_database; }
bool get_ring(const crypto::key_image &key_image, std::vector<uint64_t> &outs);
bool get_rings(const crypto::hash &txid, std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &outs);