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 uint256 GetBlockHash() const
{ {
if(phashBlock == NULL) { if(phashBlock == NULL) {
fprintf(stderr, "GetBlockHash: phashBlock NULL at height %d\n", this->GetHeight()); auto header = this->GetBlockHeader();
assert(phashBlock); 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; return *phashBlock;
} }