Differentiate raw POSHash from full one adjusted by vout value
This commit is contained in:
@@ -46,8 +46,9 @@ void CBlockHeader::SetVerusHash()
|
||||
}
|
||||
|
||||
// returns false if unable to fast calculate the VerusPOSHash from the header. it can still be calculated from the block
|
||||
// in that case
|
||||
bool CBlockHeader::GetVerusPOSHash(uint256 &value, int32_t nHeight) const
|
||||
// in that case. the only difference between this and the POS hash for the contest is that it is not divided by the value out
|
||||
// this is used as a source of entropy
|
||||
bool CBlockHeader::GetRawVerusPOSHash(uint256 &value, int32_t nHeight) const
|
||||
{
|
||||
// if below the required height or no storage space in the solution, we can't get
|
||||
// a cached txid value to calculate the POSHash from the header
|
||||
@@ -78,7 +79,7 @@ uint256 CBlockHeader::GetVerusEntropyHash(int32_t height) const
|
||||
{
|
||||
uint256 retVal;
|
||||
// if we qualify as PoW, use PoW hash, regardless of PoS state
|
||||
if (GetVerusPOSHash(retVal, height))
|
||||
if (GetRawVerusPOSHash(retVal, height))
|
||||
{
|
||||
// POS hash
|
||||
return retVal;
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
uint256 GetVerusHash() const;
|
||||
static void SetVerusHash();
|
||||
|
||||
bool GetVerusPOSHash(uint256 &value, int32_t nHeight) const;
|
||||
bool GetRawVerusPOSHash(uint256 &value, int32_t nHeight) const;
|
||||
uint256 GetVerusEntropyHash(int32_t nHeight) const;
|
||||
|
||||
uint256 GetVerusV2Hash() const;
|
||||
|
||||
@@ -10,7 +10,7 @@ extern char ASSETCHAINS_SYMBOL[65];
|
||||
|
||||
bool CPOSNonce::NewPOSActive(int32_t height)
|
||||
{
|
||||
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) || (height < (96480 + 100)))
|
||||
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) && (height < (96480 + 100)))
|
||||
return false;
|
||||
else if ((strcmp(ASSETCHAINS_SYMBOL, "VRSCTEST") == 0) && (height < (1000 + 100)))
|
||||
return false;
|
||||
@@ -20,7 +20,7 @@ bool CPOSNonce::NewPOSActive(int32_t height)
|
||||
|
||||
bool CPOSNonce::NewNonceActive(int32_t height)
|
||||
{
|
||||
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) || (height < 96480))
|
||||
if ((strcmp(ASSETCHAINS_SYMBOL, "VRSC") == 0) && (height < 96480))
|
||||
return false;
|
||||
else if ((strcmp(ASSETCHAINS_SYMBOL, "VRSCTEST") == 0) && (height < 1000))
|
||||
return false;
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
|
||||
|
||||
/** For POS blocks, the nNonce of a block header holds the entropy source for the POS contest
|
||||
* in the latest VerusHash protocol, implemented at block below
|
||||
*
|
||||
* in the latest VerusHash protocol
|
||||
* */
|
||||
class CPOSNonce : public uint256
|
||||
{
|
||||
|
||||
@@ -487,7 +487,7 @@ public:
|
||||
{
|
||||
hashWriter << *pNonce;
|
||||
hashWriter << height;
|
||||
return hashWriter.GetHash();
|
||||
return ArithToUint256(UintToArith256(hashWriter.GetHash()) / value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -495,7 +495,7 @@ public:
|
||||
hashWriter << height;
|
||||
hashWriter << txid;
|
||||
hashWriter << voutNum;
|
||||
return hashWriter.GetHash();
|
||||
return ArithToUint256(UintToArith256(hashWriter.GetHash()) / value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ public:
|
||||
if (voutNum >= vout.size())
|
||||
return uint256S("ff0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f");
|
||||
|
||||
return ArithToUint256(UintToArith256(_GetVerusPOSHash(pNonce, txid, voutNum, height, pastHash, (uint64_t)vout[voutNum].nValue)) / vout[voutNum].nValue);
|
||||
return _GetVerusPOSHash(pNonce, txid, voutNum, height, pastHash, (uint64_t)vout[voutNum].nValue);
|
||||
}
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
Reference in New Issue
Block a user