Implementation of VerusHash CPU-friendly hash algorithm, parameters to enable it, miner, and all changes required to support it on new asset chains
This commit is contained in:
@@ -10,11 +10,33 @@
|
||||
#include "utilstrencodings.h"
|
||||
#include "crypto/common.h"
|
||||
|
||||
uint256 CBlockHeader::GetHash() const
|
||||
// default hash algorithm for block
|
||||
uint256 (CBlockHeader::*CBlockHeader::hashFunction)() const = &CBlockHeader::GetSHA256DHash;
|
||||
|
||||
uint256 CBlockHeader::GetSHA256DHash() const
|
||||
{
|
||||
return SerializeHash(*this);
|
||||
}
|
||||
|
||||
uint256 CBlockHeader::GetVerusHash() const
|
||||
{
|
||||
if (hashPrevBlock == uint256())
|
||||
// always use SHA256D for genesis block
|
||||
return SerializeHash(*this);
|
||||
else
|
||||
return SerializeVerusHash(*this);
|
||||
}
|
||||
|
||||
void CBlockHeader::SetSHA256DHash()
|
||||
{
|
||||
CBlockHeader::hashFunction = &CBlockHeader::GetSHA256DHash;
|
||||
}
|
||||
|
||||
void CBlockHeader::SetVerusHash()
|
||||
{
|
||||
CBlockHeader::hashFunction = &CBlockHeader::GetVerusHash;
|
||||
}
|
||||
|
||||
uint256 CBlock::BuildMerkleTree(bool* fMutated) const
|
||||
{
|
||||
/* WARNING! If you're reading this because you're learning about crypto
|
||||
|
||||
Reference in New Issue
Block a user