EpicCash / epic

Blockchain Node Server with integrated Stratum Mining Server
https://epiccash.com
Apache License 2.0
24 stars 36 forks source link

Add 'disable_checkpoints' config setting, refactor checkpoint code #103

Closed who-biz closed 1 year ago

who-biz commented 1 year ago

This commit adds a config file option in server settings called disable_checkpoints

Fast Sync with pow skipping now covers three different usage cases:

  1. User sets ONLY skip_pow_validation = true

    • results in skipping of pow validation on all blocks up to last checkpoint (2,050,000 in source)
  2. User sets skip_pow_validation = true AND disable_checkpoints = true

    • results in fast sync all the way to chaintip (pow validation begins only once we've synced all historical blocks)
  3. User sets neither

    • results in full-chain validation.

This also required some code refactoring to accommodate the new mechanics, and config file access through inheritance. I actually like this implementation a lot better, as it is easier to follow than the previous.

Finally, it resolves an omission I made, in original submission of skip_pow_validation functionality (not sure it would have made a difference, but its resolved here also)

who-biz commented 1 year ago

Small hack for quicker testing: comment out the newer checkpoints and recompile... same effect willl trigger at whichever height is included in the last checkpoint.