aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-05-18 23:09:00 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-05-18 23:09:00 +0800
commita528bd04db4adc8de707f8b5a3a7b2cef52a2fbc (patch)
treeae1be73e5fa7a2b53d0b52856f6d4b6ac501238d /rpc/api.go
parentd381d9a74cc2cb4e8cebf21aa9e4927a6e1867d6 (diff)
downloadgo-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.tar
go-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.tar.gz
go-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.tar.bz2
go-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.tar.lz
go-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.tar.xz
go-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.tar.zst
go-tangerine-a528bd04db4adc8de707f8b5a3a7b2cef52a2fbc.zip
Return nil for certain fields on eth_getTransactionByHash when not part of a block
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 47409b4af..495f07835 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -1,6 +1,7 @@
package rpc
import (
+ "bytes"
"encoding/json"
"math/big"
// "sync"
@@ -247,9 +248,12 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
tx, bhash, bnum, txi := api.xeth().EthTransactionByHash(args.Hash)
if tx != nil {
v := NewTransactionRes(tx)
- v.BlockHash = newHexData(bhash)
- v.BlockNumber = newHexNum(bnum)
- v.TxIndex = newHexNum(txi)
+ // 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 {
+ v.BlockHash = newHexData(bhash)
+ v.BlockNumber = newHexNum(bnum)
+ v.TxIndex = newHexNum(txi)
+ }
*reply = v
}
case "eth_getTransactionByBlockHashAndIndex":