Fix ctB calc
This commit is contained in:
11
src/pow.cpp
11
src/pow.cpp
@@ -189,10 +189,13 @@ arith_uint256 zawy_exponential(arith_uint256 bnTarget,int32_t mult)
|
|||||||
|
|
||||||
arith_uint256 zawy_ctB(arith_uint256 bnTarget,uint32_t solvetime)
|
arith_uint256 zawy_ctB(arith_uint256 bnTarget,uint32_t solvetime)
|
||||||
{
|
{
|
||||||
bnTarget /= arith_uint256(K);
|
int64_t num;
|
||||||
bnTarget *= arith_uint256((int64_t)solvetime * solvetime * 1000);
|
num = (K * (int64_t)solvetime * solvetime * 1000) / (T * T * 784);
|
||||||
bnTarget /= arith_uint256(T * T * 784);
|
if ( num > 1 )
|
||||||
bnTarget *= arith_uint256(K);
|
{
|
||||||
|
bnTarget /= arith_uint256(K);
|
||||||
|
bnTarget *= arith_uint256(num);
|
||||||
|
}
|
||||||
return(bnTarget);
|
return(bnTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ UniValue genminingCSV(const UniValue& params, bool fHelp)
|
|||||||
str[32] = 0;
|
str[32] = 0;
|
||||||
//hash = pindex->GetBlockHash();
|
//hash = pindex->GetBlockHash();
|
||||||
memset(&hash,0,sizeof(hash));
|
memset(&hash,0,sizeof(hash));
|
||||||
if ( (pindex->nBits & 3) != 0 )
|
if ( i > 64 && (pindex->nBits & 3) != 0 )
|
||||||
hash = zawy_ctB(bnTarget,solvetime);
|
hash = zawy_ctB(bnTarget,solvetime);
|
||||||
for (z=0; z<16; z++)
|
for (z=0; z<16; z++)
|
||||||
sprintf(&str2[z<<1],"%02x",((uint8_t *)&hash)[31-z]);
|
sprintf(&str2[z<<1],"%02x",((uint8_t *)&hash)[31-z]);
|
||||||
|
|||||||
Reference in New Issue
Block a user