diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-05-19 21:14:48 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-05-19 21:14:48 +0800 |
commit | 748263d2f011382c832cbebb8d4e10fba8a09f71 (patch) | |
tree | cd36539deeaa66dd46e3590343bad409ba37c578 /rpc/api.go | |
parent | 54b5c8273db33ebc2bee762b92fa4a6c24e6ad94 (diff) | |
download | go-tangerine-748263d2f011382c832cbebb8d4e10fba8a09f71.tar.gz go-tangerine-748263d2f011382c832cbebb8d4e10fba8a09f71.tar.zst go-tangerine-748263d2f011382c832cbebb8d4e10fba8a09f71.zip |
Use bytes.Repeat() instead of 32-byte literal
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rpc/api.go b/rpc/api.go index b2566cfc5..0c1409d71 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -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 @@ -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) |