aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/CMakeLists.txt2
-rw-r--r--src/rpc/bootstrap_node_selector.cpp2
-rw-r--r--src/rpc/bootstrap_node_selector.h2
-rw-r--r--src/rpc/core_rpc_server.cpp14
-rw-r--r--src/rpc/core_rpc_server.h2
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h17
-rw-r--r--src/rpc/core_rpc_server_error_codes.h2
-rw-r--r--src/rpc/daemon_handler.cpp2
-rw-r--r--src/rpc/daemon_handler.h2
-rw-r--r--src/rpc/daemon_messages.cpp2
-rw-r--r--src/rpc/daemon_messages.h2
-rw-r--r--src/rpc/daemon_rpc_version.h2
-rw-r--r--src/rpc/fwd.h2
-rw-r--r--src/rpc/instanciations.cpp2
-rw-r--r--src/rpc/message.cpp2
-rw-r--r--src/rpc/message.h2
-rw-r--r--src/rpc/message_data_structs.h2
-rw-r--r--src/rpc/rpc_args.cpp2
-rw-r--r--src/rpc/rpc_args.h2
-rw-r--r--src/rpc/rpc_handler.h2
-rw-r--r--src/rpc/rpc_payment.cpp2
-rw-r--r--src/rpc/rpc_payment.h2
-rw-r--r--src/rpc/rpc_payment_costs.h2
-rw-r--r--src/rpc/rpc_payment_signature.cpp2
-rw-r--r--src/rpc/rpc_payment_signature.h2
-rw-r--r--src/rpc/rpc_version_str.cpp2
-rw-r--r--src/rpc/rpc_version_str.h2
-rw-r--r--src/rpc/zmq_pub.cpp2
-rw-r--r--src/rpc/zmq_pub.h2
-rw-r--r--src/rpc/zmq_server.cpp2
-rw-r--r--src/rpc/zmq_server.h2
31 files changed, 56 insertions, 33 deletions
diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt
index fe80d3083..d01a4c44a 100644
--- a/src/rpc/CMakeLists.txt
+++ b/src/rpc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014-2023, The Monero Project
+# Copyright (c) 2014-2024, The Monero Project
#
# All rights reserved.
#
diff --git a/src/rpc/bootstrap_node_selector.cpp b/src/rpc/bootstrap_node_selector.cpp
index d224c5c53..fab671d4e 100644
--- a/src/rpc/bootstrap_node_selector.cpp
+++ b/src/rpc/bootstrap_node_selector.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2023, The Monero Project
+// Copyright (c) 2020-2024, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/bootstrap_node_selector.h b/src/rpc/bootstrap_node_selector.h
index 3e52c3538..5931ca9d7 100644
--- a/src/rpc/bootstrap_node_selector.h
+++ b/src/rpc/bootstrap_node_selector.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2023, The Monero Project
+// Copyright (c) 2020-2024, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 92948b6d1..7fcd1e6d7 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2023, The Monero Project
+// Copyright (c) 2014-2024, The Monero Project
//
// All rights reserved.
//
@@ -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.h b/src/rpc/core_rpc_server.h
index 7c31d2539..a80b977c2 100644
--- a/src/rpc/core_rpc_server.h
+++ b/src/rpc/core_rpc_server.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2023, The Monero Project
+// Copyright (c) 2014-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 46b17bae9..1c8525d45 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2023, The Monero Project
+// Copyright (c) 2014-2024, The Monero Project
//
// All rights reserved.
//
@@ -80,6 +80,19 @@ namespace cryptonote
#define CORE_RPC_STATUS_NOT_MINING "NOT MINING"
#define CORE_RPC_STATUS_PAYMENT_REQUIRED "PAYMENT REQUIRED"
+inline const std::string get_rpc_status(const bool trusted_daemon, const std::string &s)
+{
+ if (trusted_daemon)
+ return s;
+ if (s == CORE_RPC_STATUS_OK)
+ return s;
+ if (s == CORE_RPC_STATUS_BUSY)
+ return s;
+ if (s == CORE_RPC_STATUS_PAYMENT_REQUIRED)
+ return s;
+ return "<error>";
+}
+
// When making *any* change here, bump minor
// If the change is incompatible, then bump major and set minor to 0
// This ensures CORE_RPC_VERSION always increases, that every change
@@ -176,6 +189,7 @@ namespace cryptonote
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)
@@ -184,6 +198,7 @@ namespace cryptonote
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()
};
diff --git a/src/rpc/core_rpc_server_error_codes.h b/src/rpc/core_rpc_server_error_codes.h
index 2a4726a89..bccbb1d73 100644
--- a/src/rpc/core_rpc_server_error_codes.h
+++ b/src/rpc/core_rpc_server_error_codes.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2023, The Monero Project
+// Copyright (c) 2014-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_handler.cpp b/src/rpc/daemon_handler.cpp
index ef767ffbc..fac061cad 100644
--- a/src/rpc/daemon_handler.cpp
+++ b/src/rpc/daemon_handler.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Monero Project
+// Copyright (c) 2017-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_handler.h b/src/rpc/daemon_handler.h
index 11a6c2849..1da5419d2 100644
--- a/src/rpc/daemon_handler.h
+++ b/src/rpc/daemon_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Monero Project
+// Copyright (c) 2017-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_messages.cpp b/src/rpc/daemon_messages.cpp
index 36528fcea..ad3896862 100644
--- a/src/rpc/daemon_messages.cpp
+++ b/src/rpc/daemon_messages.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_messages.h b/src/rpc/daemon_messages.h
index f4e4d00f7..83546fce3 100644
--- a/src/rpc/daemon_messages.h
+++ b/src/rpc/daemon_messages.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/daemon_rpc_version.h b/src/rpc/daemon_rpc_version.h
index d14b85ed9..a9e34b926 100644
--- a/src/rpc/daemon_rpc_version.h
+++ b/src/rpc/daemon_rpc_version.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/fwd.h b/src/rpc/fwd.h
index 6227f5696..f312d6eda 100644
--- a/src/rpc/fwd.h
+++ b/src/rpc/fwd.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2023, The Monero Project
+// Copyright (c) 2019-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/instanciations.cpp b/src/rpc/instanciations.cpp
index d4f5231f3..352031695 100644
--- a/src/rpc/instanciations.cpp
+++ b/src/rpc/instanciations.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Monero Project
+// Copyright (c) 2017-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/message.cpp b/src/rpc/message.cpp
index 9fda96e71..e2d0270ca 100644
--- a/src/rpc/message.cpp
+++ b/src/rpc/message.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/message.h b/src/rpc/message.h
index b7253e09b..e4e57ba05 100644
--- a/src/rpc/message.h
+++ b/src/rpc/message.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/message_data_structs.h b/src/rpc/message_data_structs.h
index 542d71239..3fff923b7 100644
--- a/src/rpc/message_data_structs.h
+++ b/src/rpc/message_data_structs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_args.cpp b/src/rpc/rpc_args.cpp
index e6233fa98..18a3fb90c 100644
--- a/src/rpc/rpc_args.cpp
+++ b/src/rpc/rpc_args.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2023, The Monero Project
+// Copyright (c) 2014-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_args.h b/src/rpc/rpc_args.h
index ac6a5d7cd..0286db062 100644
--- a/src/rpc/rpc_args.h
+++ b/src/rpc/rpc_args.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2023, The Monero Project
+// Copyright (c) 2014-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_handler.h b/src/rpc/rpc_handler.h
index e13d3036f..f18f4afe2 100644
--- a/src/rpc/rpc_handler.h
+++ b/src/rpc/rpc_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment.cpp b/src/rpc/rpc_payment.cpp
index 71a00aca4..40f37b5bf 100644
--- a/src/rpc/rpc_payment.cpp
+++ b/src/rpc/rpc_payment.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2023, The Monero Project
+// Copyright (c) 2018-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment.h b/src/rpc/rpc_payment.h
index a4cc6db57..227d937dd 100644
--- a/src/rpc/rpc_payment.h
+++ b/src/rpc/rpc_payment.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2023, The Monero Project
+// Copyright (c) 2018-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment_costs.h b/src/rpc/rpc_payment_costs.h
index 36ee5ec1d..37d6635c0 100644
--- a/src/rpc/rpc_payment_costs.h
+++ b/src/rpc/rpc_payment_costs.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2023, The Monero Project
+// Copyright (c) 2019-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment_signature.cpp b/src/rpc/rpc_payment_signature.cpp
index ec7aeb715..3e7f5fd7d 100644
--- a/src/rpc/rpc_payment_signature.cpp
+++ b/src/rpc/rpc_payment_signature.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2023, The Monero Project
+// Copyright (c) 2018-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_payment_signature.h b/src/rpc/rpc_payment_signature.h
index f0539446f..dea6bac05 100644
--- a/src/rpc/rpc_payment_signature.h
+++ b/src/rpc/rpc_payment_signature.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2023, The Monero Project
+// Copyright (c) 2018-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_version_str.cpp b/src/rpc/rpc_version_str.cpp
index 07756d636..1d44df6f0 100644
--- a/src/rpc/rpc_version_str.cpp
+++ b/src/rpc/rpc_version_str.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2023, The Monero Project
+// Copyright (c) 2019-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/rpc_version_str.h b/src/rpc/rpc_version_str.h
index 2cfa9f867..40254d707 100644
--- a/src/rpc/rpc_version_str.h
+++ b/src/rpc/rpc_version_str.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019-2023, The Monero Project
+// Copyright (c) 2019-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/zmq_pub.cpp b/src/rpc/zmq_pub.cpp
index 4c620c59a..cc9705d35 100644
--- a/src/rpc/zmq_pub.cpp
+++ b/src/rpc/zmq_pub.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2023, The Monero Project
+// Copyright (c) 2020-2024, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/zmq_pub.h b/src/rpc/zmq_pub.h
index fe60527a6..add9481c6 100644
--- a/src/rpc/zmq_pub.h
+++ b/src/rpc/zmq_pub.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020-2023, The Monero Project
+// Copyright (c) 2020-2024, The Monero Project
//
// All rights reserved.
diff --git a/src/rpc/zmq_server.cpp b/src/rpc/zmq_server.cpp
index d73ea3bc9..96aaee8f4 100644
--- a/src/rpc/zmq_server.cpp
+++ b/src/rpc/zmq_server.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//
diff --git a/src/rpc/zmq_server.h b/src/rpc/zmq_server.h
index b561fd580..c72730a63 100644
--- a/src/rpc/zmq_server.h
+++ b/src/rpc/zmq_server.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2023, The Monero Project
+// Copyright (c) 2016-2024, The Monero Project
//
// All rights reserved.
//