worked around compiler issue with types
This commit is contained in:
12
src/pow.cpp
12
src/pow.cpp
@@ -167,8 +167,8 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
|
|||||||
int64_t N = params.nPOSAveragingWindow;
|
int64_t N = params.nPOSAveragingWindow;
|
||||||
|
|
||||||
struct solveSequence {
|
struct solveSequence {
|
||||||
|
int64_t solveTime;
|
||||||
bool consecutive;
|
bool consecutive;
|
||||||
uint32_t solveTime;
|
|
||||||
uint32_t nBits;
|
uint32_t nBits;
|
||||||
solveSequence()
|
solveSequence()
|
||||||
{
|
{
|
||||||
@@ -186,7 +186,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
|
|||||||
// if we have had no POS block in the threshold number of blocks, we must return the default, otherwise, we'll now have
|
// if we have had no POS block in the threshold number of blocks, we must return the default, otherwise, we'll now have
|
||||||
// a starting point
|
// a starting point
|
||||||
uint32_t nBits = nProofOfStakeLimit;
|
uint32_t nBits = nProofOfStakeLimit;
|
||||||
for (int i = 0; i < VERUS_NOPOS_THRESHHOLD; i++)
|
for (int64_t i = 0; i < VERUS_NOPOS_THRESHHOLD; i++)
|
||||||
{
|
{
|
||||||
if (!pindexFirst)
|
if (!pindexFirst)
|
||||||
return nProofOfStakeLimit;
|
return nProofOfStakeLimit;
|
||||||
@@ -205,7 +205,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
|
|||||||
std::vector<solveSequence> idx = std::vector<solveSequence>();
|
std::vector<solveSequence> idx = std::vector<solveSequence>();
|
||||||
idx.resize(N);
|
idx.resize(N);
|
||||||
|
|
||||||
for (int i = N - 1; i >= 0; i--)
|
for (int64_t i = N - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
// we measure our solve time in passing of blocks, where one bock == VERUS_BLOCK_POSUNITS units
|
// we measure our solve time in passing of blocks, where one bock == VERUS_BLOCK_POSUNITS units
|
||||||
// consecutive blocks in either direction have their solve times exponentially multiplied or divided by power of 2
|
// consecutive blocks in either direction have their solve times exponentially multiplied or divided by power of 2
|
||||||
@@ -238,7 +238,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
|
|||||||
// go forward and halve the minimum solve time for all consecutive blocks in this run, to get here, our last block is POS,
|
// go forward and halve the minimum solve time for all consecutive blocks in this run, to get here, our last block is POS,
|
||||||
// and if there is no POS block in front of it, it gets the normal solve time of one block
|
// and if there is no POS block in front of it, it gets the normal solve time of one block
|
||||||
uint32_t st = VERUS_BLOCK_POSUNITS;
|
uint32_t st = VERUS_BLOCK_POSUNITS;
|
||||||
for (int j = i; j < N; j++)
|
for (int64_t j = i; j < N; j++)
|
||||||
{
|
{
|
||||||
if (idx[j].consecutive == true)
|
if (idx[j].consecutive == true)
|
||||||
{
|
{
|
||||||
@@ -246,7 +246,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
|
|||||||
if ((j - i) >= VERUS_CONSECUTIVE_POS_THRESHOLD)
|
if ((j - i) >= VERUS_CONSECUTIVE_POS_THRESHOLD)
|
||||||
{
|
{
|
||||||
// if this is real time, return zero
|
// if this is real time, return zero
|
||||||
if (i > (N - VERUS_CONSECUTIVE_POS_THRESHOLD))
|
if (j == (N - 1))
|
||||||
{
|
{
|
||||||
// target of 0 (virtually impossible), if we hit max consecutive POS blocks
|
// target of 0 (virtually impossible), if we hit max consecutive POS blocks
|
||||||
nextTarget.SetCompact(0);
|
nextTarget.SetCompact(0);
|
||||||
@@ -261,7 +261,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus::
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = N - 1; i >= 0; i--)
|
for (int64_t i = N - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
// weighted sum
|
// weighted sum
|
||||||
t += idx[i].solveTime * i;
|
t += idx[i].solveTime * i;
|
||||||
|
|||||||
Reference in New Issue
Block a user