aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-01 04:40:12 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-01 04:40:12 +0800
commit40ea46620066bd7888b3f9a425fcd6201e0c7320 (patch)
tree298a8041dfc26c837c57410ff5b175a656e31217 /xeth/xeth.go
parent7e3875b52720bf7456c9dd6162caeb7250d3686e (diff)
downloadgo-tangerine-40ea46620066bd7888b3f9a425fcd6201e0c7320.tar.gz
go-tangerine-40ea46620066bd7888b3f9a425fcd6201e0c7320.tar.zst
go-tangerine-40ea46620066bd7888b3f9a425fcd6201e0c7320.zip
Store and retrieve tx context metadata #608
Improving this in the future will allow for cleaning up a bit of legacy code.
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go23
1 files changed, 20 insertions, 3 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 7e1548964..fcc03b85f 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -185,12 +185,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
+
+ // 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)
+ }
+ // txindex
+ data, _ = self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0003))
+ if len(data) != 0 {
+ txi = common.BytesToNumber(data)
+ }
+
+ return
}
func (self *XEth) BlockByNumber(num int64) *Block {