From 2273155e7e325a2a6a940fffae7e9f6744b2ec22 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 12 Mar 2015 15:59:07 +0100 Subject: Get transaction implemented * Added a GetTransaction to XEth * Implemented the `eth_getTransactionByHash` RPC method --- xeth/xeth.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'xeth') diff --git a/xeth/xeth.go b/xeth/xeth.go index 70172a1c8..4c28caf86 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -32,6 +32,7 @@ type Backend interface { Peers() []*p2p.Peer BlockDb() ethutil.Database StateDb() ethutil.Database + ExtraDb() ethutil.Database EventMux() *event.TypeMux Whisper() *whisper.Whisper @@ -127,6 +128,14 @@ func (self *XEth) EthBlockByHash(strHash string) *types.Block { return block } +func (self *XEth) EthTransactionByHash(hash string) *types.Transaction { + data, _ := self.eth.ExtraDb().Get(fromHex(hash)) + if len(data) != 0 { + return types.NewTransactionFromBytes(data) + } + return nil +} + func (self *XEth) BlockByNumber(num int64) *Block { if num == -1 { return NewBlock(self.chainManager.CurrentBlock()) @@ -231,10 +240,6 @@ func (self *XEth) SecretToAddress(key string) string { return toHex(pair.Address()) } -func (self *XEth) Execute(addr, value, gas, price, data string) (string, error) { - return "", nil -} - type KeyVal struct { Key string `json:"key"` Value string `json:"value"` -- cgit v1.2.3