Skip to content

Commit e2d72a9

Browse files
authored
Add support to retrieve genesis if empty hash is supplied (#238)
- This is used by the block indexer in the "blockcore-bitcore" repo.
1 parent 3e78dc0 commit e2d72a9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Blockcore/Consensus/Chain/ChainIndexer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ public virtual ChainedHeader GetHeader(uint256 id)
221221
{
222222
lock (this.lockObject)
223223
{
224+
// If node is looking for zero, we'll return the genesis block.
225+
if (id == uint256.Zero)
226+
{
227+
return this.blocksByHeight[0];
228+
}
229+
224230
ChainedHeader result;
225231
this.blocksById.TryGetValue(id, out result);
226232
return result;

0 commit comments

Comments
 (0)