Make GetBlockHash() calculate the blockhash if phashBlock is null

This commit is contained in:
Duke
2023-04-23 06:02:22 -07:00
parent cf1274a42a
commit ca6a1c48bb

View File

@@ -513,8 +513,11 @@ public:
uint256 GetBlockHash() const
{
if(phashBlock == NULL) {
fprintf(stderr, "GetBlockHash: phashBlock NULL at height %d\n", this->GetHeight());
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() );
// assert(phashBlock);
return blockhash;
}
return *phashBlock;
}