Commit 6e0c3071 by Nullfunction

Fix safety measure

parent 73602c14
......@@ -1363,7 +1363,7 @@ unsigned int LwmaCalculateNextWorkRequired(const CBlockIndex* pindexLast, bool f
// pblock->GetBlockTime() > pindexLast->GetBlockTime() + 60 * 10) {
// return UintToArith256(params.PowLimit(true)).GetCompact();
// }
const int T = GetTargetSpacing(pindexLast->nHeight);
const int N = 45; // Avg Window
const int k = 13632; //Adjusted Weight
const int height = pindexLast->nHeight + 1;
......@@ -1382,7 +1382,10 @@ unsigned int LwmaCalculateNextWorkRequired(const CBlockIndex* pindexLast, bool f
j++;
t += solvetime * j; // Weighted solvetime sum.
// TODO: Get safety feature -6/5 from pseudo code
// Safety measure
if (solvetime > 7 * T) { solvetime = 7 * T; }
if (solvetime < -(6 * T)) { solvetime = -(6 * T); }
// Target sum divided by a factor, (k N^2).
// The factor is a part of the final equation. However we divide sum_target here to avoid
// potential overflow.
......@@ -1487,13 +1490,6 @@ void CBlock::UpdateTime(const CBlockIndex* pindexPrev)
bool CTransaction::DisconnectInputs(CTxDB& txdb)
{
// Relinquish previous transactions' spent pointers
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment