Set minimum difficulty for RPC "work_generate" (#2006)
* Set minimum difficulty for RPC "work_generate" * Update CLI --debug_opencl for low difficulty
This commit is contained in:
parent
c86a100d0d
commit
f7765c148d
3 changed files with 7 additions and 2 deletions
|
|
@ -153,7 +153,7 @@ std::string nano::error_rpc_messages::message (int ev) const
|
||||||
case nano::error_rpc::confirmation_not_found:
|
case nano::error_rpc::confirmation_not_found:
|
||||||
return "Active confirmation not found";
|
return "Active confirmation not found";
|
||||||
case nano::error_rpc::difficulty_limit:
|
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:
|
case nano::error_rpc::invalid_balance:
|
||||||
return "Invalid balance number";
|
return "Invalid balance number";
|
||||||
case nano::error_rpc::invalid_destinations:
|
case nano::error_rpc::invalid_destinations:
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,11 @@ int main (int argc, char * const * argv)
|
||||||
std::cerr << "Invalid difficulty\n";
|
std::cerr << "Invalid difficulty\n";
|
||||||
result = -1;
|
result = -1;
|
||||||
}
|
}
|
||||||
|
else if (difficulty < network_constants.publish_threshold)
|
||||||
|
{
|
||||||
|
std::cerr << "Difficulty below publish threshold\n";
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4345,7 +4345,7 @@ void nano::json_handler::work_generate ()
|
||||||
ec = nano::error_rpc::bad_difficulty_format;
|
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;
|
ec = nano::error_rpc::difficulty_limit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue