Browse Source

Fix implementation of GetBlockHash in CBlockIndex and CDiskBlockIndex

pull/332/head
Duke 8 months ago
parent
commit
d99ab44bfb
  1. 13
      src/chain.h

13
src/chain.h

@ -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
{ {

Loading…
Cancel
Save