aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-01 18:51:44 +0800
committerobscuren <geffobscura@gmail.com>2015-04-01 18:51:44 +0800
commitdba9b83aa07ced653b24c3e34d55ffe13a740243 (patch)
tree0dc20ee3807e3fe5a076fbfe2ec00bd6601792a6 /xeth
parent4e8f8cfab701bb6c4ad2b8cf166d642f408ca398 (diff)
parentb0e09ec82752b48c2384c315dc420e5c39e785b6 (diff)
downloaddexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.tar
dexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.tar.gz
dexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.tar.bz2
dexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.tar.lz
dexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.tar.xz
dexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.tar.zst
dexon-dba9b83aa07ced653b24c3e34d55ffe13a740243.zip
Merge branch 'tgerring-hexify' into develop
Diffstat (limited to 'xeth')
-rw-r--r--xeth/xeth.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 7e1548964..33fda9b4b 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -19,6 +19,7 @@ import (
"github.com/ethereum/go-ethereum/event/filter"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
+ "github.com/ethereum/go-ethereum/rlp"
)
var (
@@ -185,12 +186,29 @@ func (self *XEth) EthBlockByHash(strHash string) *types.Block {
return block
}
-func (self *XEth) EthTransactionByHash(hash string) *types.Transaction {
+func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blhash common.Hash, blnum *big.Int, txi uint64) {
data, _ := self.backend.ExtraDb().Get(common.FromHex(hash))
if len(data) != 0 {
- return types.NewTransactionFromBytes(data)
+ tx = types.NewTransactionFromBytes(data)
}
- return nil
+
+ // meta
+ var txExtra struct {
+ BlockHash common.Hash
+ BlockIndex int64
+ Index uint64
+ }
+
+ v, _ := self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0001))
+ r := bytes.NewReader(v)
+ err := rlp.Decode(r, &txExtra)
+ if err == nil {
+ blhash = txExtra.BlockHash
+ blnum = big.NewInt(txExtra.BlockIndex)
+ txi = txExtra.Index
+ }
+
+ return
}
func (self *XEth) BlockByNumber(num int64) *Block {