Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazar955 committed Nov 5, 2024
1 parent 5867cc0 commit b8bf34a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion btcclient/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ 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 @@ -34,7 +38,11 @@ func (c *Client) GetBlockByHash(blockHash *chainhash.Hash) (*types.IndexedBlock,
}

btcTxs := types.GetWrappedTxs(mBlock)
return types.NewIndexedBlock(uint32(blockInfo.Height), &mBlock.Header, btcTxs), mBlock, nil
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
}

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

0 comments on commit b8bf34a

Please sign in to comment.