diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 75b4a1226..9367d8804 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2234,6 +2234,25 @@ namespace cryptonote return false; } + if (m_restricted && ctx) + { + block parent; + if (!m_core.get_block_by_hash(b.prev_id, parent)) + { + error_resp.code = CORE_RPC_ERROR_CODE_BLOCK_NOT_ACCEPTED; + error_resp.message = "Unknown parent block"; + return false; + } + const uint64_t block_height = get_block_height(parent) + 1; + const uint64_t chain_height = m_core.get_current_blockchain_height(); + if (crypto::rx_seedheight(block_height) != crypto::rx_seedheight(chain_height)) + { + error_resp.code = CORE_RPC_ERROR_CODE_BLOCK_NOT_ACCEPTED; + error_resp.message = "Block is too old for restricted RPC"; + return false; + } + } + block_verification_context bvc; if(!m_core.handle_block_found(b, bvc)) {