Skip to content

Instantly share code, notes, and snippets.

@GeertJohan
Created January 7, 2015 00:45
Show Gist options
  • Save GeertJohan/14fa6f23e5c0105972e4 to your computer and use it in GitHub Desktop.
Save GeertJohan/14fa6f23e5c0105972e4 to your computer and use it in GitHub Desktop.

Clean up Digishield for use in Guldencoin.

Removing unused local variable nHeight.

Both nTargetSpacing and nTargetTimespanNEW are defined as 2.5*60, which means that retargetInterval will always equal 1. This means that (pindexLast->nHeight+1) % retargetInterval will always resolve to 0 and therefore the block following if ((pindexLast->nHeight+1) % retargetInterval != 0) will never be ran. Removing the complete block as it is dead code.

Removing the genesis exception, we're never mining a genesis block with DIGI.

Removing the now unused local variables nProofOfWorkLimit and retargetSpacing.

Statement if ((pindexLast->nHeight+1) != retargetInterval) will never be false in oru case. This means blockstogoback is always set to retargetInterval which always equals to 1. This makes for (int i = 0; pindexFirst && i < blockstogoback; i++) utterly useless. Removing it completely.

Removing the now unused local variable retargetInterval.

Setting retargetTimespan to nTargetSpacing (same to nTargetTimespanNEW) and removing the now unused nTargetTimespanNEW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment