diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-27 20:23:31 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2014-11-27 20:23:31 +0800 |
commit | ef7961b7d27be930a4d9dc81527a55497d3dea2e (patch) | |
tree | 5746b715b1b66c5767779e2e4ca66be345333e13 /xeth | |
parent | c17a3cb0ceec44c10bc84d05f0d81f08894c792c (diff) | |
parent | 8cf9ed0ea588e97f2baf0f834248727e8fbca18f (diff) | |
download | dexon-ef7961b7d27be930a4d9dc81527a55497d3dea2e.tar.gz dexon-ef7961b7d27be930a4d9dc81527a55497d3dea2e.tar.zst dexon-ef7961b7d27be930a4d9dc81527a55497d3dea2e.zip |
Merge pull request #194 from ethereum/poc8
Update tests branch to PoC8
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/hexface.go | 9 | ||||
-rw-r--r-- | xeth/js_types.go | 9 | ||||
-rw-r--r-- | xeth/pipe.go | 11 | ||||
-rw-r--r-- | xeth/vm_env.go | 7 |
4 files changed, 19 insertions, 17 deletions
diff --git a/xeth/hexface.go b/xeth/hexface.go index 5ef3eaf1a..5bf9845d4 100644 --- a/xeth/hexface.go +++ b/xeth/hexface.go @@ -6,6 +6,7 @@ import ( "sync/atomic" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" @@ -209,7 +210,7 @@ func (self *JSXEth) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr gas = ethutil.Big(gasStr) gasPrice = ethutil.Big(gasPriceStr) data []byte - tx *chain.Transaction + tx *types.Transaction ) if ethutil.IsHex(codeStr) { @@ -219,9 +220,9 @@ func (self *JSXEth) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr } if contractCreation { - tx = chain.NewContractCreationTx(value, gas, gasPrice, data) + tx = types.NewContractCreationTx(value, gas, gasPrice, data) } else { - tx = chain.NewTransactionMessage(hash, value, gas, gasPrice, data) + tx = types.NewTransactionMessage(hash, value, gas, gasPrice, data) } acc := self.obj.BlockManager().TransState().GetOrNewStateObject(keyPair.Address()) @@ -240,7 +241,7 @@ func (self *JSXEth) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr } func (self *JSXEth) PushTx(txStr string) (*JSReceipt, error) { - tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(txStr)) + tx := types.NewTransactionFromBytes(ethutil.Hex2Bytes(txStr)) self.obj.TxPool().QueueTransaction(tx) return NewJSReciept(tx.CreatesContract(), tx.CreationAddress(self.World().State()), tx.Hash(), tx.Sender()), nil } diff --git a/xeth/js_types.go b/xeth/js_types.go index ff240e21c..cba674416 100644 --- a/xeth/js_types.go +++ b/xeth/js_types.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/state" @@ -14,7 +15,7 @@ import ( // Block interface exposed to QML type JSBlock struct { //Transactions string `json:"transactions"` - ref *chain.Block + ref *types.Block Size string `json:"size"` Number int `json:"number"` Hash string `json:"hash"` @@ -31,7 +32,7 @@ type JSBlock struct { } // Creates a new QML Block from a chain block -func NewJSBlock(block *chain.Block) *JSBlock { +func NewJSBlock(block *types.Block) *JSBlock { if block == nil { return &JSBlock{} } @@ -79,7 +80,7 @@ func (self *JSBlock) GetTransaction(hash string) *JSTransaction { } type JSTransaction struct { - ref *chain.Transaction + ref *types.Transaction Value string `json:"value"` Gas string `json:"gas"` @@ -94,7 +95,7 @@ type JSTransaction struct { Confirmations int `json:"confirmations"` } -func NewJSTx(tx *chain.Transaction, state *state.State) *JSTransaction { +func NewJSTx(tx *types.Transaction, state *state.State) *JSTransaction { hash := ethutil.Bytes2Hex(tx.Hash()) receiver := ethutil.Bytes2Hex(tx.Recipient) if receiver == "0000000000000000000000000000000000000000" { diff --git a/xeth/pipe.go b/xeth/pipe.go index abed8ef9a..8130ab72e 100644 --- a/xeth/pipe.go +++ b/xeth/pipe.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/logger" @@ -72,7 +73,7 @@ func (self *XEth) ExecuteObject(object *Object, data []byte, value, gas, price * return ret, err } -func (self *XEth) Block(hash []byte) *chain.Block { +func (self *XEth) Block(hash []byte) *types.Block { return self.blockChain.GetBlock(hash) } @@ -115,7 +116,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, rec []byte, value, gas, price *e contractCreation = true } - var tx *chain.Transaction + var tx *types.Transaction // Compile and assemble the given data if contractCreation { script, err := ethutil.Compile(string(data), false) @@ -123,7 +124,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, rec []byte, value, gas, price *e return nil, err } - tx = chain.NewContractCreationTx(value.BigInt(), gas.BigInt(), price.BigInt(), script) + tx = types.NewContractCreationTx(value.BigInt(), gas.BigInt(), price.BigInt(), script) } else { data := ethutil.StringToByteFunc(string(data), func(s string) (ret []byte) { slice := strings.Split(s, "\n") @@ -134,7 +135,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, rec []byte, value, gas, price *e return }) - tx = chain.NewTransactionMessage(hash, value.BigInt(), gas.BigInt(), price.BigInt(), data) + tx = types.NewTransactionMessage(hash, value.BigInt(), gas.BigInt(), price.BigInt(), data) } acc := self.blockManager.TransState().GetOrNewStateObject(key.Address()) @@ -155,7 +156,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, rec []byte, value, gas, price *e return tx.Hash(), nil } -func (self *XEth) PushTx(tx *chain.Transaction) ([]byte, error) { +func (self *XEth) PushTx(tx *types.Transaction) ([]byte, error) { self.obj.TxPool().QueueTransaction(tx) if tx.Recipient == nil { addr := tx.CreationAddress(self.World().State()) diff --git a/xeth/vm_env.go b/xeth/vm_env.go index 68b13e5a8..10575ad79 100644 --- a/xeth/vm_env.go +++ b/xeth/vm_env.go @@ -2,20 +2,19 @@ package xeth import ( "math/big" - - "github.com/ethereum/go-ethereum/chain" + "github.com/ethereum/go-ethereum/chain/types" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" ) type VMEnv struct { state *state.State - block *chain.Block + block *types.Block value *big.Int sender []byte } -func NewEnv(state *state.State, block *chain.Block, value *big.Int, sender []byte) *VMEnv { +func NewEnv(state *state.State, block *types.Block, value *big.Int, sender []byte) *VMEnv { return &VMEnv{ state: state, block: block, |