diff options
Diffstat (limited to 'src/primitives/block.cpp')
| -rw-r--r-- | src/primitives/block.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 2b6a302ee..5b9c13d87 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -8,10 +8,11 @@ #include "hash.h" #include "tinyformat.h" #include "utilstrencodings.h" +#include "crypto/common.h" uint256 CBlockHeader::GetHash() const { - return Hash(BEGIN(nVersion), END(nNonce)); + return SerializeHash(*this); } uint256 CBlock::BuildMerkleTree(bool* fMutated) const @@ -74,7 +75,7 @@ uint256 CBlock::BuildMerkleTree(bool* fMutated) const if (fMutated) { *fMutated = mutated; } - return (vMerkleTree.empty() ? 0 : vMerkleTree.back()); + return (vMerkleTree.empty() ? uint256() : vMerkleTree.back()); } std::vector<uint256> CBlock::GetMerkleBranch(int nIndex) const @@ -96,7 +97,7 @@ std::vector<uint256> CBlock::GetMerkleBranch(int nIndex) const uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMerkleBranch, int nIndex) { if (nIndex == -1) - return 0; + return uint256(); for (std::vector<uint256>::const_iterator it(vMerkleBranch.begin()); it != vMerkleBranch.end(); ++it) { if (nIndex & 1) |