aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2022-08-26 16:13:19 -0700
committerj-berman <justinberman@protonmail.com>2022-09-12 21:23:08 -0600
commit864a78ee5f5db4619c093e0dfb26bd03735d9fb1 (patch)
tree75db44fd75f9a7e037ed2325c91e5f0087258991 /src/rpc
parentMerge pull request #8555 (diff)
downloadmonero-864a78ee5f5db4619c093e0dfb26bd03735d9fb1.tar.xz
wallet2: check wallet compatibility with daemon's hard fork version
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp4
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h21
2 files changed, 24 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 8d13b7634..16bcf2c04 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -2861,6 +2861,10 @@ namespace cryptonote
res.version = CORE_RPC_VERSION;
res.release = MONERO_VERSION_IS_RELEASE;
+ res.current_height = m_core.get_current_blockchain_height();
+ res.target_height = m_p2p.get_payload_object().is_synchronized() ? 0 : m_core.get_target_blockchain_height();
+ for (const auto &hf : m_core.get_blockchain_storage().get_hardforks())
+ res.hard_forks.push_back({hf.version, hf.height});
res.status = CORE_RPC_STATUS_OK;
return true;
}
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 1be2610ff..e1222f6eb 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -88,7 +88,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 3
-#define CORE_RPC_VERSION_MINOR 10
+#define CORE_RPC_VERSION_MINOR 11
#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)
@@ -2123,15 +2123,34 @@ namespace cryptonote
};
typedef epee::misc_utils::struct_init<request_t> request;
+ struct hf_entry
+ {
+ uint8_t hf_version;
+ uint64_t height;
+
+ bool operator==(const hf_entry& hfe) const { return hf_version == hfe.hf_version && height == hfe.height; }
+
+ BEGIN_KV_SERIALIZE_MAP()
+ KV_SERIALIZE(hf_version)
+ KV_SERIALIZE(height)
+ END_KV_SERIALIZE_MAP()
+ };
+
struct response_t: public rpc_response_base
{
uint32_t version;
bool release;
+ uint64_t current_height;
+ uint64_t target_height;
+ std::vector<hf_entry> hard_forks;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_PARENT(rpc_response_base)
KV_SERIALIZE(version)
KV_SERIALIZE(release)
+ KV_SERIALIZE_OPT(current_height, (uint64_t)0)
+ KV_SERIALIZE_OPT(target_height, (uint64_t)0)
+ KV_SERIALIZE_OPT(hard_forks, std::vector<hf_entry>())
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;