Fix implementation of GetBlockHash in CBlockIndex and CDiskBlockIndex

This commit is contained in:
Duke
2023-10-23 22:41:29 -04:00
parent 31a6b72caf
commit d99ab44bfb

View File

@@ -512,13 +512,7 @@ public:
uint256 GetBlockHash() const uint256 GetBlockHash() const
{ {
if(phashBlock == NULL) { assert(phashBlock);
auto header = this->GetBlockHeader();
auto blockhash = header.GetHash();
fprintf(stderr, "GetBlockHash: phashBlock NULL at height %d, returning blockhash=%s instead\n", this->GetHeight(), blockhash.ToString().c_str() );
// assert(phashBlock);
return blockhash;
}
return *phashBlock; return *phashBlock;
} }
@@ -683,6 +677,11 @@ public:
} }
} }
uint256 GetBlockHash() const
{
return GetBlockHeader().GetHash();
}
//! Get the block header for this block index. //! Get the block header for this block index.
CBlockHeader GetBlockHeader() const CBlockHeader GetBlockHeader() const
{ {