Get transaction implemented
* Added a GetTransaction to XEth * Implemented the `eth_getTransactionByHash` RPC method
This commit is contained in:
13
xeth/xeth.go
13
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"`
|
||||
|
Reference in New Issue
Block a user