aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-04 17:28:02 +0800
committerobscuren <geffobscura@gmail.com>2014-12-04 17:28:02 +0800
commit9008b155d3c8d2a32c4c8945f1174243d48d4e90 (patch)
treea55140b7d4802a0db14cbc265b8ca21d44d6f10a /xeth
parentb6cb5272de96185b424d5c6c4a817d99f536d29b (diff)
downloadgo-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar
go-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.gz
go-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.bz2
go-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.lz
go-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.xz
go-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.zst
go-tangerine-9008b155d3c8d2a32c4c8945f1174243d48d4e90.zip
Renamed `chain` => `core`
Diffstat (limited to 'xeth')
-rw-r--r--xeth/hexface.go59
-rw-r--r--xeth/js_types.go10
-rw-r--r--xeth/pipe.go12
-rw-r--r--xeth/vm_env.go8
4 files changed, 19 insertions, 70 deletions
diff --git a/xeth/hexface.go b/xeth/hexface.go
index 6360c7675..c1f49453d 100644
--- a/xeth/hexface.go
+++ b/xeth/hexface.go
@@ -5,8 +5,8 @@ import (
"encoding/json"
"sync/atomic"
- "github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/chain/types"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
@@ -16,7 +16,7 @@ type JSXEth struct {
*XEth
}
-func NewJSXEth(eth chain.EthManager) *JSXEth {
+func NewJSXEth(eth core.EthManager) *JSXEth {
return &JSXEth{New(eth)}
}
@@ -64,7 +64,7 @@ func (self *JSXEth) PeerCount() int {
func (self *JSXEth) Peers() []JSPeer {
var peers []JSPeer
for peer := self.obj.Peers().Front(); peer != nil; peer = peer.Next() {
- p := peer.Value.(chain.Peer)
+ p := peer.Value.(core.Peer)
// we only want connected peers
if atomic.LoadInt32(p.Connected()) != 0 {
peers = append(peers, *NewJSPeer(p))
@@ -220,57 +220,6 @@ func (self *JSXEth) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
}
return ethutil.Bytes2Hex(tx.Hash()), nil
-
- /*
- var hash []byte
- var contractCreation bool
- if len(toStr) == 0 {
- contractCreation = true
- } else {
- // Check if an address is stored by this address
- addr := self.World().Config().Get("NameReg").StorageString(toStr).Bytes()
- if len(addr) > 0 {
- hash = addr
- } else {
- hash = ethutil.Hex2Bytes(toStr)
- }
- }
-
-
- var (
- value = ethutil.Big(valueStr)
- gas = ethutil.Big(gasStr)
- gasPrice = ethutil.Big(gasPriceStr)
- data []byte
- tx *chain.Transaction
- )
-
- if ethutil.IsHex(codeStr) {
- data = ethutil.Hex2Bytes(codeStr[2:])
- } else {
- data = ethutil.Hex2Bytes(codeStr)
- }
-
- if contractCreation {
- tx = chain.NewContractCreationTx(value, gas, gasPrice, data)
- } else {
- tx = chain.NewTransactionMessage(hash, value, gas, gasPrice, data)
- }
-
- acc := self.obj.BlockManager().TransState().GetOrNewStateObject(keyPair.Address())
- tx.Nonce = acc.Nonce
- acc.Nonce += 1
- self.obj.BlockManager().TransState().UpdateStateObject(acc)
-
- tx.Sign(keyPair.PrivateKey)
- self.obj.TxPool().QueueTransaction(tx)
-
- if contractCreation {
- pipelogger.Infof("Contract addr %x", tx.CreationAddress(self.World().State()))
- }
-
- return NewJSReciept(contractCreation, tx.CreationAddress(self.World().State()), tx.Hash(), keyPair.Address()), nil
- */
}
func (self *JSXEth) PushTx(txStr string) (*JSReceipt, error) {
diff --git a/xeth/js_types.go b/xeth/js_types.go
index cba674416..6aba3d993 100644
--- a/xeth/js_types.go
+++ b/xeth/js_types.go
@@ -5,8 +5,8 @@ import (
"strconv"
"strings"
- "github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/chain/types"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
@@ -106,7 +106,7 @@ func NewJSTx(tx *types.Transaction, state *state.State) *JSTransaction {
var data string
if tx.CreatesContract() {
- data = strings.Join(chain.Disassemble(tx.Data), "\n")
+ data = strings.Join(core.Disassemble(tx.Data), "\n")
} else {
data = ethutil.Bytes2Hex(tx.Data)
}
@@ -155,7 +155,7 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *
// Peer interface exposed to QML
type JSPeer struct {
- ref *chain.Peer
+ ref *core.Peer
Inbound bool `json:"isInbound"`
LastSend int64 `json:"lastSend"`
LastPong int64 `json:"lastPong"`
@@ -167,7 +167,7 @@ type JSPeer struct {
Caps string `json:"caps"`
}
-func NewJSPeer(peer chain.Peer) *JSPeer {
+func NewJSPeer(peer core.Peer) *JSPeer {
if peer == nil {
return nil
}
diff --git a/xeth/pipe.go b/xeth/pipe.go
index 2dfb91b7f..cabcc1cbe 100644
--- a/xeth/pipe.go
+++ b/xeth/pipe.go
@@ -5,8 +5,8 @@ package xeth
*/
import (
- "github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/chain/types"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
@@ -20,15 +20,15 @@ type VmVars struct {
}
type XEth struct {
- obj chain.EthManager
- blockManager *chain.BlockManager
- blockChain *chain.ChainManager
+ obj core.EthManager
+ blockManager *core.BlockManager
+ blockChain *core.ChainManager
world *World
Vm VmVars
}
-func New(obj chain.EthManager) *XEth {
+func New(obj core.EthManager) *XEth {
pipe := &XEth{
obj: obj,
blockManager: obj.BlockManager(),
diff --git a/xeth/vm_env.go b/xeth/vm_env.go
index d11459626..831a310cc 100644
--- a/xeth/vm_env.go
+++ b/xeth/vm_env.go
@@ -3,8 +3,8 @@ package xeth
import (
"math/big"
- "github.com/ethereum/go-ethereum/chain"
- "github.com/ethereum/go-ethereum/chain/types"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
@@ -46,10 +46,10 @@ func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error {
return vm.Transfer(from, to, amount)
}
-func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *chain.Execution {
+func (self *VMEnv) vm(addr, data []byte, gas, price, value *big.Int) *core.Execution {
evm := vm.New(self, vm.DebugVmTy)
- return chain.NewExecution(evm, addr, data, gas, price, value)
+ return core.NewExecution(evm, addr, data, gas, price, value)
}
func (self *VMEnv) Call(me vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) {