aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-01 18:14:35 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-01 18:14:35 +0800
commit86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c (patch)
tree903183222dc26998d44fb0e2cf682fa2f4aadeca /xeth/xeth.go
parentb860b6769329137c24024c2330529d7b2078d89d (diff)
downloadgo-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.tar
go-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.tar.gz
go-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.tar.bz2
go-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.tar.lz
go-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.tar.xz
go-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.tar.zst
go-tangerine-86ba7432a965d9469ce1b4ccc2397ed2e08c9a3c.zip
txMeta storage as struct
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go27
1 files changed, 14 insertions, 13 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index fcc03b85f..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 (
@@ -191,20 +192,20 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha
tx = types.NewTransactionFromBytes(data)
}
- // blockhash
- data, _ = self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0001))
- if len(data) != 0 {
- blhash = common.BytesToHash(data)
- }
- // blocknum
- data, _ = self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0002))
- if len(data) != 0 {
- blnum = common.Bytes2Big(data)
+ // meta
+ var txExtra struct {
+ BlockHash common.Hash
+ BlockIndex int64
+ Index uint64
}
- // txindex
- data, _ = self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0003))
- if len(data) != 0 {
- txi = common.BytesToNumber(data)
+
+ 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