Verus Proof of Stake Compete with Additional ant-fork protection on block 1

This commit is contained in:
Michael Toutonghi
2018-05-13 18:59:06 -07:00
parent 6939648e84
commit 1f722359c1
20 changed files with 458 additions and 53 deletions

View File

@@ -12,6 +12,7 @@
#include "serialize.h"
#include "uint256.h"
#include "consensus/consensus.h"
#include "hash.h"
#ifndef __APPLE__
#include <stdint.h>
@@ -24,6 +25,8 @@
#include "zcash/JoinSplit.hpp"
#include "zcash/Proof.hpp"
extern uint32_t ASSETCHAINS_MAGIC;
class JSDescription
{
public:
@@ -469,6 +472,28 @@ public:
return a.hash != b.hash;
}
// verus hash will be the same for a given txid, output number, block height, and blockhash of 100 blocks past
static uint256 _GetVerusPOSHash(const uint256 &txid, int32_t voutNum, int32_t height, const uint256 &pastHash, int64_t value)
{
CVerusHashWriter hashWriter = CVerusHashWriter(SER_GETHASH, PROTOCOL_VERSION);
hashWriter << ASSETCHAINS_MAGIC;
hashWriter << pastHash;
hashWriter << height;
hashWriter << txid;
hashWriter << voutNum;
return hashWriter.GetHash();
}
uint256 GetVerusPOSHash(int32_t voutNum, int32_t height, const uint256 &pastHash) const
{
uint256 txid = GetHash();
if (voutNum >= vout.size())
return uint256();
return _GetVerusPOSHash(txid, voutNum, height, pastHash, (uint64_t)vout[voutNum].nValue);
}
std::string ToString() const;
};