Portable VerusHash and CPU check

This commit is contained in:
Michael Toutonghi
2018-06-16 14:51:13 -07:00
parent 2c05c25598
commit 5296a85018
10 changed files with 537 additions and 5 deletions

View File

@@ -84,6 +84,9 @@ public:
uint256 GetVerusHash() const;
static void SetVerusHash();
uint256 GetVerusHashPortable() const;
static void SetVerusHashPortable();
uint256 GetVerusMiningHash() const;
int64_t GetBlockTime() const
@@ -107,14 +110,14 @@ public:
{
arith_uint256 arNonce = UintToArith256(nNonce);
arith_uint256 tmpNonce = ((arNonce << 128) >> 128);
CVerusHashWriter hashWriter = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
CVerusHashPortableWriter hashWriter = CVerusHashPortableWriter(SER_GETHASH, PROTOCOL_VERSION);
hashWriter << ArithToUint256(tmpNonce);
return (nNonce == ArithToUint256(UintToArith256(hashWriter.GetHash()) << 128 | tmpNonce));
}
void SetVerusPOSTarget(int32_t nBits)
{
CVerusHashWriter hashWriter = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
CVerusHashPortableWriter hashWriter = CVerusHashPortableWriter(SER_GETHASH, PROTOCOL_VERSION);
uint256 hash;
arith_uint256 tmpNonce;