Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazar955 committed Nov 5, 2024
1 parent 6827c6a commit 5867cc0
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions btcclient/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ func (c *Client) GetBestBlock() (uint32, error) {
return 0, err
}

if height < 0 || height > int64(^uint32(0)) {
panic(fmt.Errorf("height (%d) is out of uint32 range", height)) //software bug, panic
}

return uint32(height), nil
}

Expand All @@ -38,11 +34,7 @@ func (c *Client) GetBlockByHash(blockHash *chainhash.Hash) (*types.IndexedBlock,
}

btcTxs := types.GetWrappedTxs(mBlock)
height := blockInfo.Height
if height < 0 || height > int64(^uint32(0)) {
panic(fmt.Errorf("height (%d) is out of uint32 range", height)) //software bug, panic
}
return types.NewIndexedBlock(uint32(height), &mBlock.Header, btcTxs), mBlock, nil
return types.NewIndexedBlock(uint32(blockInfo.Height), &mBlock.Header, btcTxs), mBlock, nil
}

// GetBlockByHeight returns a block with the given height
Expand Down

0 comments on commit 5867cc0

Please sign in to comment.