Closed s0sasaki closed 5 years ago
@knasher A new block's sPrevHash is changed in Blockchain::AddBlock after Block::Block and before Block::MineBlock. If sHash is not calculated in Block::MineBlock, it can be incompatible with sPrevHash.
Ah yes, well spotted! In that case, it might be worth removing the initial CalculateHash call from the constructor, what do you think?
@knasher I think we should keep the initial calculateHash for the genesis block!
What bug does this code fix? The hash is already calculated on instantiation of the block, you change will mean the hash will be calculated twice before it is checked; which would waste both time and computational resources.