diff --git a/nano/lib/errors.cpp b/nano/lib/errors.cpp index a97ceccfb0..0c70e3c7d3 100644 --- a/nano/lib/errors.cpp +++ b/nano/lib/errors.cpp @@ -153,7 +153,7 @@ std::string nano::error_rpc_messages::message (int ev) const case nano::error_rpc::confirmation_not_found: return "Active confirmation not found"; case nano::error_rpc::difficulty_limit: - return "Difficulty above config limit"; + return "Difficulty above config limit or below publish threshold"; case nano::error_rpc::invalid_balance: return "Invalid balance number"; case nano::error_rpc::invalid_destinations: diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index 5f06518522..6765dfb32c 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -390,6 +390,11 @@ int main (int argc, char * const * argv) std::cerr << "Invalid difficulty\n"; result = -1; } + else if (difficulty < network_constants.publish_threshold) + { + std::cerr << "Difficulty below publish threshold\n"; + result = -1; + } } if (!result) { diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index 647700b67d..8be6142ce1 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -4345,7 +4345,7 @@ void nano::json_handler::work_generate () ec = nano::error_rpc::bad_difficulty_format; } } - if (!ec && difficulty > node_rpc_config.max_work_generate_difficulty) + if (!ec && (difficulty > node_rpc_config.max_work_generate_difficulty || difficulty < node.network_params.network.publish_threshold)) { ec = nano::error_rpc::difficulty_limit; }