aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp12
1 files changed, 10 insertions, 2 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;