PoS improvements

This commit is contained in:
Michael Toutonghi
2018-07-18 17:42:15 -07:00
parent 37ad688668
commit c5325a3256
12 changed files with 260 additions and 43 deletions

View File

@@ -7,6 +7,7 @@
#define BITCOIN_PRIMITIVES_BLOCK_H
#include "primitives/transaction.h"
#include "primitives/nonce.h"
#include "serialize.h"
#include "uint256.h"
#include "arith_uint256.h"
@@ -33,7 +34,7 @@ public:
uint256 hashReserved;
uint32_t nTime;
uint32_t nBits;
uint256 nNonce;
CPOSNonce nNonce;
std::vector<unsigned char> nSolution;
CBlockHeader()
@@ -84,6 +85,9 @@ public:
uint256 GetVerusHash() const;
static void SetVerusHash();
bool GetVerusPOSHash(uint256 &value, int32_t nHeight) const;
uint256 GetVerusEntropyHash(int32_t nHeight) const;
uint256 GetVerusV2Hash() const;
int64_t GetBlockTime() const
@@ -105,11 +109,7 @@ public:
bool IsVerusPOSBlock() const
{
arith_uint256 arNonce = UintToArith256(nNonce);
arith_uint256 tmpNonce = ((arNonce << 128) >> 128);
CVerusHashWriter hashWriter = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
hashWriter << ArithToUint256(tmpNonce);
return (nNonce == ArithToUint256(UintToArith256(hashWriter.GetHash()) << 128 | tmpNonce));
return nNonce.IsPOSNonce();
}
void SetVerusPOSTarget(int32_t nBits)