Renamed chain
=> core
This commit is contained in:
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
12
xeth/pipe.go
12
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(),
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user