Canonicalize chain ID calculation
When using an external genesis file, it doesn't make sense to calculate the chain ID as the literal text contents of the file, which are quite volatile. Rather, it should be calculated based on the logical content of the file. Serialize the genesis object to get a canonical representation, and calculate the chain ID off of that.
This commit is contained in:
parent
c833ca646f
commit
de87e1b82c
1 changed files with 2 additions and 3 deletions
|
|
@ -321,9 +321,8 @@ namespace detail {
|
||||||
ilog("Initializing database...");
|
ilog("Initializing database...");
|
||||||
if( _options->count("genesis-json") )
|
if( _options->count("genesis-json") )
|
||||||
{
|
{
|
||||||
std::string genesis_str;
|
genesis_state_type genesis = fc::json::from_file( _options->at("genesis-json").as<boost::filesystem::path>()).as<genesis_state_type>( 20 );
|
||||||
fc::read_file_contents( _options->at("genesis-json").as<boost::filesystem::path>(), genesis_str );
|
std::string genesis_str = fc::json::to_string(genesis) + "\n";
|
||||||
genesis_state_type genesis = fc::json::from_string( genesis_str ).as<genesis_state_type>( 20 );
|
|
||||||
bool modified_genesis = false;
|
bool modified_genesis = false;
|
||||||
if( _options->count("genesis-timestamp") )
|
if( _options->count("genesis-timestamp") )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue