Skip to content

Commit

Permalink
Replace CBlockHeader::GetHash with call to SerializeHash
Browse files Browse the repository at this point in the history
Removes variability between LE and BE.
As suggested by @sipa.
  • Loading branch information
laanwj committed Mar 6, 2015
1 parent 62b30f0 commit a0ae79d
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/primitives/block.cpp
Expand Up @@ -12,18 +12,7 @@

uint256 CBlockHeader::GetHash() const
{
#if defined(WORDS_BIGENDIAN)
uint8_t data[80];
WriteLE32(&data[0], nVersion);
memcpy(&data[4], hashPrevBlock.begin(), hashPrevBlock.size());
memcpy(&data[36], hashMerkleRoot.begin(), hashMerkleRoot.size());
WriteLE32(&data[68], nTime);
WriteLE32(&data[72], nBits);
WriteLE32(&data[76], nNonce);
return Hash(data, data + 80);
#else // Can take shortcut for little endian
return Hash(BEGIN(nVersion), END(nNonce));
#endif
return SerializeHash(*this);
}

uint256 CBlock::BuildMerkleTree(bool* fMutated) const
Expand Down

0 comments on commit a0ae79d

Please sign in to comment.