Commit 748263d2 authored by Taylor Gerring's avatar Taylor Gerring

Use bytes.Repeat() instead of 32-byte literal

parent 54b5c827
...@@ -230,6 +230,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err ...@@ -230,6 +230,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
block := api.xeth().EthBlockByNumber(args.BlockNumber) block := api.xeth().EthBlockByNumber(args.BlockNumber)
br := NewBlockRes(block, args.IncludeTxs) br := NewBlockRes(block, args.IncludeTxs)
// If request was for "pending", nil nonsensical fields
if args.BlockNumber == -2 { if args.BlockNumber == -2 {
br.BlockHash = nil br.BlockHash = nil
br.BlockNumber = nil br.BlockNumber = nil
...@@ -247,7 +248,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err ...@@ -247,7 +248,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
if tx != nil { if tx != nil {
v := NewTransactionRes(tx) v := NewTransactionRes(tx)
// if the blockhash is 0, assume this is a pending transaction // 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.BlockHash = newHexData(bhash)
v.BlockNumber = newHexNum(bnum) v.BlockNumber = newHexNum(bnum)
v.TxIndex = newHexNum(txi) v.TxIndex = newHexNum(txi)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment