aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp7
-rw-r--r--src/cryptonote_core/cryptonote_core.h12
-rw-r--r--src/rpc/core_rpc_server.cpp2
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h4
4 files changed, 23 insertions, 2 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 7cbf414b7..3e3d3c19c 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -181,7 +181,8 @@ namespace cryptonote
m_last_json_checkpoints_update(0),
m_disable_dns_checkpoints(false),
m_update_download(0),
- m_nettype(UNDEFINED)
+ m_nettype(UNDEFINED),
+ m_update_available(false)
{
m_checkpoints_updating.clear();
set_cryptonote_protocol(pprotocol);
@@ -1541,10 +1542,14 @@ namespace cryptonote
return false;
if (tools::vercmp(version.c_str(), MONERO_VERSION) <= 0)
+ {
+ m_update_available = false;
return true;
+ }
std::string url = tools::get_update_url(software, subdir, buildtag, version, true);
MCLOG_CYAN(el::Level::Info, "global", "Version " << version << " of " << software << " for " << buildtag << " is available: " << url << ", SHA256 hash " << hash);
+ m_update_available = true;
if (check_updates_level == UPDATES_NOTIFY)
return true;
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index b40575ae9..58fe5b7b5 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -739,6 +739,16 @@ namespace cryptonote
network_type get_nettype() const { return m_nettype; };
/**
+ * @brief check whether an update is known to be available or not
+ *
+ * This does not actually trigger a check, but returns the result
+ * of the last check
+ *
+ * @return whether an update is known to be available or not
+ */
+ bool is_update_available() const { return m_update_available; }
+
+ /**
* @brief get whether fluffy blocks are enabled
*
* @return whether fluffy blocks are enabled
@@ -966,6 +976,8 @@ namespace cryptonote
network_type m_nettype; //!< which network are we on?
+ std::atomic<bool> m_update_available;
+
std::string m_checkpoints_path; //!< path to json checkpoints file
time_t m_last_dns_checkpoints_update; //!< time when dns checkpoints were last updated
time_t m_last_json_checkpoints_update; //!< time when json checkpoints were last updated
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 0443f696e..3508208bc 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -208,6 +208,7 @@ namespace cryptonote
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
}
res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
+ res.update_available = m_core.is_update_available();
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
@@ -1595,6 +1596,7 @@ namespace cryptonote
res.was_bootstrap_ever_used = m_was_bootstrap_ever_used;
}
res.database_size = m_core.get_blockchain_storage().get_db().get_database_size();
+ res.update_available = m_core.is_update_available();
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index b1cf2bdd7..3b654d4cb 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -49,7 +49,7 @@ namespace cryptonote
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define CORE_RPC_VERSION_MAJOR 2
-#define CORE_RPC_VERSION_MINOR 0
+#define CORE_RPC_VERSION_MINOR 1
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
@@ -893,6 +893,7 @@ namespace cryptonote
uint64_t height_without_bootstrap;
bool was_bootstrap_ever_used;
uint64_t database_size;
+ bool update_available;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
@@ -926,6 +927,7 @@ namespace cryptonote
KV_SERIALIZE(height_without_bootstrap)
KV_SERIALIZE(was_bootstrap_ever_used)
KV_SERIALIZE(database_size)
+ KV_SERIALIZE(update_available)
END_KV_SERIALIZE_MAP()
};
};