Skip to content

Commit

Permalink
Espers v0.8.7.5 Update-29 Patch-13
Browse files Browse the repository at this point in the history
Changelog

- Corrected VRX to match standardized v3.5 implementation
  • Loading branch information
CryptoCoderz committed Aug 20, 2020
1 parent 1399b1f commit 73007d5
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/core/blockparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ int64_t scantime_1 = 0;
int64_t scantime_2 = 0;
int64_t prevPoW = 0; // hybrid value
int64_t prevPoS = 0; // hybrid value
uint64_t blkTime = 0;
uint64_t cntTime = 0;
uint64_t prvTime = 0;
uint64_t difTime = 0;
Expand All @@ -70,6 +71,7 @@ uint64_t difCurve = 0;
uint64_t debugHourRounds = 0;
uint64_t debugDifCurve = 0;
bool fDryRun;
bool fCRVreset;
const CBlockIndex* pindexPrev = 0;
const CBlockIndex* BlockVelocityType = 0;
CBigNum bnVelocity = 0;
Expand Down Expand Up @@ -103,6 +105,10 @@ void VRXswngdebug()
debugTerminalAverage /= debugDifCurve;
LogPrintf("diffTime%s is greater than %u Hours: %u \n",difType.c_str(),debugHourRounds,cntTime);
LogPrintf("Difficulty will be multiplied by: %d \n",debugTerminalAverage);
// Break loop after 5 hours, otherwise time threshold will auto-break loop
if (debugHourRounds > 5){
break;
}
debugDifCurve ++;
debugHourRounds ++;
}
Expand Down Expand Up @@ -399,11 +405,13 @@ void VRX_ThreadCurve(const CBlockIndex* pindexLast, bool fProofOfStake)
if(pindexBest->GetBlockTime() > SWING_PATCH) // ON (TOGGLED Nov/01/2017)
{
// Define time values
blkTime = pindexLast->GetBlockTime();
cntTime = BlockVelocityType->GetBlockTime();
prvTime = BlockVelocityType->pprev->GetBlockTime();
difTime = cntTime - prvTime;
hourRounds = 1;
difCurve = 2;
fCRVreset = false;

// Debug print toggle
if(fProofOfStake) {
Expand All @@ -415,15 +423,19 @@ void VRX_ThreadCurve(const CBlockIndex* pindexLast, bool fProofOfStake)

// Version 1.2 Extended Curve Run Upgrade
if(pindexLast->nHeight+1 >= nLiveForkToggle && nLiveForkToggle != 0) {
// Set unbiased comparison
difTime = blkTime - cntTime;
// Run Curve
while(difTime > (hourRounds * 60 * 60)) {
// Break loop after 5 hours, otherwise time threshold will auto-break loop
if (hourRounds > 5){
fCRVreset = true;
break;
}
// Drop difficulty per round
TerminalAverage /= difCurve;
// Simulate retarget for sanity
VRX_Simulate_Retarget();
// Break loop on nbit limit, otherwise time threshold will auto-break loop
if (bnNew > bnVelocity){
break;
}
// Increase Curve per round
difCurve ++;
// Move up an hour per round
Expand Down Expand Up @@ -458,6 +470,11 @@ void VRX_Dry_Run(const CBlockIndex* pindexLast)
}
}

// Test Fork
if (nLiveForkToggle != 0) {
// Do nothing
}// TODO setup next testing fork

// Standard, non-Dry Run
fDryRun = false;
return;
Expand All @@ -477,6 +494,7 @@ unsigned int VRX_Retarget(const CBlockIndex* pindexLast, bool fProofOfStake)

// Run VRX threadcurve
VRX_ThreadCurve(pindexLast, fProofOfStake);
if (fCRVreset) { return bnVelocity.GetCompact(); }

// Retarget using simulation
VRX_Simulate_Retarget();
Expand Down

0 comments on commit 73007d5

Please sign in to comment.