aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-18 18:44:25 +0800
committerobscuren <geffobscura@gmail.com>2015-03-18 18:44:25 +0800
commit942980609fb8a36873689bd3bd0a15488f327d56 (patch)
treed9de01873dc04c4e4042cf1260fe180d01f259bb /xeth
parentcd52ef315cf4d65cfb5282f72d795849266e3ab5 (diff)
downloadgo-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.tar
go-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.tar.gz
go-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.tar.bz2
go-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.tar.lz
go-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.tar.xz
go-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.tar.zst
go-tangerine-942980609fb8a36873689bd3bd0a15488f327d56.zip
conversions
Diffstat (limited to 'xeth')
-rw-r--r--xeth/state.go6
-rw-r--r--xeth/types.go38
2 files changed, 22 insertions, 22 deletions
diff --git a/xeth/state.go b/xeth/state.go
index 7d9ceab1b..f645a9cac 100644
--- a/xeth/state.go
+++ b/xeth/state.go
@@ -19,7 +19,7 @@ func (self *State) State() *state.StateDB {
}
func (self *State) Get(addr string) *Object {
- return &Object{self.state.GetStateObject(common.FromHex(addr))}
+ return &Object{self.state.GetStateObject(common.HexToAddress(addr))}
}
func (self *State) SafeGet(addr string) *Object {
@@ -27,9 +27,9 @@ func (self *State) SafeGet(addr string) *Object {
}
func (self *State) safeGet(addr string) *state.StateObject {
- object := self.state.GetStateObject(common.FromHex(addr))
+ object := self.state.GetStateObject(common.HexToAddress(addr))
if object == nil {
- object = state.NewStateObject(common.FromHex(addr), self.xeth.eth.StateDb())
+ object = state.NewStateObject(common.HexToAddress(addr), self.xeth.eth.StateDb())
}
return object
diff --git a/xeth/types.go b/xeth/types.go
index e15305481..d6d2a11f7 100644
--- a/xeth/types.go
+++ b/xeth/types.go
@@ -5,10 +5,10 @@ import (
"fmt"
"strings"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
- "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/state"
@@ -59,19 +59,19 @@ func (self *Object) Storage() (storage map[string]string) {
type Block struct {
//Transactions string `json:"transactions"`
ref *types.Block
- Size string `json:"size"`
- Number int `json:"number"`
- Hash string `json:"hash"`
+ Size string `json:"size"`
+ Number int `json:"number"`
+ Hash string `json:"hash"`
Transactions *common.List `json:"transactions"`
Uncles *common.List `json:"uncles"`
- Time int64 `json:"time"`
- Coinbase string `json:"coinbase"`
- Name string `json:"name"`
- GasLimit string `json:"gasLimit"`
- GasUsed string `json:"gasUsed"`
- PrevHash string `json:"prevHash"`
- Bloom string `json:"bloom"`
- Raw string `json:"raw"`
+ Time int64 `json:"time"`
+ Coinbase string `json:"coinbase"`
+ Name string `json:"name"`
+ GasLimit string `json:"gasLimit"`
+ GasUsed string `json:"gasUsed"`
+ PrevHash string `json:"prevHash"`
+ Bloom string `json:"bloom"`
+ Raw string `json:"raw"`
}
// Creates a new QML Block from a chain block
@@ -95,12 +95,12 @@ func NewBlock(block *types.Block) *Block {
return &Block{
ref: block, Size: block.Size().String(),
Number: int(block.NumberU64()), GasUsed: block.GasUsed().String(),
- GasLimit: block.GasLimit().String(), Hash: toHex(block.Hash()),
+ GasLimit: block.GasLimit().String(), Hash: toHex(block.Hash().Bytes()),
Transactions: txlist, Uncles: ulist,
Time: block.Time(),
- Coinbase: toHex(block.Coinbase()),
- PrevHash: toHex(block.ParentHash()),
- Bloom: toHex(block.Bloom()),
+ Coinbase: toHex(block.Coinbase().Bytes()),
+ PrevHash: toHex(block.ParentHash().Bytes()),
+ Bloom: toHex(block.Bloom().Bytes()),
Raw: block.String(),
}
}
@@ -114,7 +114,7 @@ func (self *Block) ToString() string {
}
func (self *Block) GetTransaction(hash string) *Transaction {
- tx := self.ref.Transaction(common.FromHex(hash))
+ tx := self.ref.Transaction(common.HexToHash(hash))
if tx == nil {
return nil
}
@@ -139,8 +139,8 @@ type Transaction struct {
}
func NewTx(tx *types.Transaction) *Transaction {
- hash := toHex(tx.Hash())
- receiver := toHex(tx.To())
+ hash := tx.Hash().Hex()
+ receiver := tx.To().Hex()
if len(receiver) == 0 {
receiver = toHex(core.AddressFromMessage(tx))
}