diff options
author | luigi1111 <luigi1111w@gmail.com> | 2024-07-16 19:00:06 -0400 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2024-07-16 19:00:06 -0400 |
commit | 4ed5bc543614aa8325bb4f40b1be70942916d48d (patch) | |
tree | fd7d0fe05cb942b0f155125182700b1defb6291c | |
parent | Merge pull request #9379 (diff) | |
parent | Daemon RPC: high_height_ok req boolean field /getblocks.bin (diff) | |
download | monero-4ed5bc543614aa8325bb4f40b1be70942916d48d.tar.xz |
Merge pull request #9382
356829a Daemon RPC: high_height_ok req boolean field /getblocks.bin (j-berman)
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 12 | ||||
-rw-r--r-- | src/rpc/core_rpc_server_commands_defs.h | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 892ae9234..e6e65889e 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -702,12 +702,20 @@ namespace cryptonote if (get_blocks) { // quick check for noop - if (!req.block_ids.empty()) + if (req.start_height > 0 || !req.block_ids.empty()) { uint64_t last_block_height; crypto::hash last_block_hash; m_core.get_blockchain_top(last_block_height, last_block_hash); - if (last_block_hash == req.block_ids.front()) + + if (!req.high_height_ok && req.start_height > last_block_height) + { + res.status = "Failed"; + return true; + } + + if (req.start_height > last_block_height || + (!req.block_ids.empty() && last_block_hash == req.block_ids.front())) { res.start_height = 0; res.current_height = last_block_height + 1; diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 80c9cc766..6b5d08e6a 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -101,7 +101,7 @@ inline const std::string get_rpc_status(const bool trusted_daemon, const std::st // 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 14 +#define CORE_RPC_VERSION_MINOR 15 #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) @@ -189,6 +189,7 @@ inline const std::string get_rpc_status(const bool trusted_daemon, const std::st uint64_t start_height; bool prune; bool no_miner_tx; + bool high_height_ok; uint64_t pool_info_since; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE_PARENT(rpc_access_request_base) @@ -197,6 +198,7 @@ inline const std::string get_rpc_status(const bool trusted_daemon, const std::st KV_SERIALIZE(start_height) KV_SERIALIZE(prune) KV_SERIALIZE_OPT(no_miner_tx, false) + KV_SERIALIZE_OPT(high_height_ok, false) // default false maintains backwards compatibility for clients that relied on failure on high height KV_SERIALIZE_OPT(pool_info_since, (uint64_t)0) END_KV_SERIALIZE_MAP() }; |