Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid introducing a virtual into CChainParams
Treat fSkipProofOfWorkCheck the same as other parameters.
- Loading branch information
Showing
2 changed files
with
3 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4705902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. But the reason I did write the virtual function returning false was to prevent any possibility of the flag being turned on on the MAIN network by mistake. This was requested by (I think) GMaxwell.
It was a protective measure...
4705902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrupting any of the other parameters will have bad consequences as well.
4705902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. There are plenty of global variables an attacker could corrupt if he has access to write arbitrary bytes in process memory. So remove it if you wish...
4705902
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Virtual pointers also provide a single place that can be overwritten to make the object point to a different class. It's a bit more difficult as you have to know what address to write, but still no rocket science...
The most extreme form of making these parameters static would be to provide the chain parameters to a template class implementing the consensus code, then compile/instantiate that for each network separately. Then at start-up, load only the code for the network that is selected.
Then again -- it may be pointless, I don't think there is any realistic protection against attackers that already have write access to your memory space.