Get transaction implemented

* Added a GetTransaction to XEth
* Implemented the `eth_getTransactionByHash` RPC method
This commit is contained in:
obscuren
2015-03-12 15:59:07 +01:00
parent 26a5636424
commit 2273155e7e
3 changed files with 27 additions and 10 deletions

View File

@ -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"`