Skip to content

Commit

Permalink
Regenerate node private key when empty key is passed to set_advanced_…
Browse files Browse the repository at this point in the history
…node_parameters steemit#1690
  • Loading branch information
theoreticalbts committed Dec 15, 2017
1 parent 321118c commit d3dd4eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libraries/net/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4448,7 +4448,10 @@ namespace graphene { namespace net {
ilog( "Loaded configuration from file ${filename}", ("filename", configuration_file_name ) );

if( _node_configuration.private_key == fc::ecc::private_key() )
{
ilog( "generating new private key for this node" );
_node_configuration.private_key = fc::ecc::private_key::generate();
}

node_configuration_loaded = true;
}
Expand Down Expand Up @@ -4997,9 +5000,16 @@ namespace graphene { namespace net {
void node_impl::set_advanced_node_parameters(const fc::variant_object& params)
{
VERIFY_CORRECT_THREAD();
ilog( "set_advanced_node_parameters ${params}", ("params", params) );

fc::from_variant( params, _node_configuration );

if( _node_configuration.private_key == fc::ecc::private_key() )
{
ilog( "generating new private key for this node" );
_node_configuration.private_key = fc::ecc::private_key::generate();
}

if( _node_configuration.desired_number_of_connections > _node_configuration.maximum_number_of_connections )
{
wlog( "Reducing desired_number_of_connections from ${x0} to maximum_number_of_connections=${x1}",
Expand Down

0 comments on commit d3dd4eb

Please sign in to comment.