Blockchain By Example
上QQ阅读APP看书,第一时间看更新

New genesis hash

While we have edited some values in the genesis block, the block's hash provided by Satoshi is no longer valid. Therefore, we have to replace it with the new one provided by the GenesisH0 script.

Under the chainParams.cpp file, you will find several occurrences of the following assertion, which refers to the old hash value of the genesis block:

assert (hashGenesisBlock == uint256 ("genesis block hash"));

These assertions verify whether the genesis block hash is congruous, otherwise code execution fails and halts further code execution. You can either comment out all of these assert methods or replace the hash with the new value of your generated genesis block (by adding 0x as a prefix).

If you get any errors related to these assertions later when you run your client, you can check whether the hashes match by printing out the computed genesis hash:

printf ("Readercoin hashGenesisBlock: % s \ n", consensus.hashGenesisBlock.ToString (). c_str ());