Skip to content

Commit

Permalink
Use bytes.Repeat() instead of 32-byte literal
Browse files Browse the repository at this point in the history
  • Loading branch information
tgerring committed May 19, 2015
1 parent 54b5c82 commit 748263d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err

block := api.xeth().EthBlockByNumber(args.BlockNumber)
br := NewBlockRes(block, args.IncludeTxs)
// If request was for "pending", nil nonsensical fields
if args.BlockNumber == -2 {
br.BlockHash = nil
br.BlockNumber = nil
Expand All @@ -247,7 +248,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
if tx != nil {
v := NewTransactionRes(tx)
// if the blockhash is 0, assume this is a pending transaction
if bytes.Compare(bhash.Bytes(), []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) != 0 {
if bytes.Compare(bhash.Bytes(), bytes.Repeat([]byte{0}, 32)) != 0 {
v.BlockHash = newHexData(bhash)
v.BlockNumber = newHexNum(bnum)
v.TxIndex = newHexNum(txi)
Expand Down

0 comments on commit 748263d

Please sign in to comment.