Renamed `chain` => `core`

pull/206/head
obscuren 10 years ago
parent b6cb5272de
commit 9008b155d3
  1. 2
      block_pool.go
  2. 3
      cmd/mist/bindings.go
  3. 4
      cmd/mist/debugger.go
  4. 14
      cmd/mist/ext_app.go
  5. 16
      cmd/mist/gui.go
  6. 3
      cmd/mist/html_container.go
  7. 3
      cmd/mist/qml_container.go
  8. 6
      cmd/mist/ui_lib.go
  9. 8
      cmd/utils/vm_env.go
  10. 0
      core/.gitignore
  11. 2
      core/asm.go
  12. 4
      core/block_manager.go
  13. 4
      core/chain_manager.go
  14. 2
      core/chain_manager_test.go
  15. 4
      core/dagger.go
  16. 2
      core/dagger_test.go
  17. 2
      core/error.go
  18. 4
      core/events.go
  19. 2
      core/execution.go
  20. 2
      core/fees.go
  21. 4
      core/filter.go
  22. 2
      core/filter_test.go
  23. 2
      core/genesis.go
  24. 2
      core/helper_test.go
  25. 4
      core/state_transition.go
  26. 4
      core/transaction_pool.go
  27. 0
      core/types/block.go
  28. 0
      core/types/bloom9.go
  29. 0
      core/types/bloom9_test.go
  30. 0
      core/types/common.go
  31. 0
      core/types/derive_sha.go
  32. 0
      core/types/receipt.go
  33. 0
      core/types/transaction.go
  34. 0
      core/types/transaction_test.go
  35. 4
      core/vm_env.go
  36. 32
      ethereum.go
  37. 6
      javascript/javascript_runtime.go
  38. 16
      miner/miner.go
  39. 2
      peer.go
  40. 12
      ui/filter.go
  41. 6
      ui/qt/filter.go
  42. 59
      xeth/hexface.go
  43. 10
      xeth/js_types.go
  44. 12
      xeth/pipe.go
  45. 8
      xeth/vm_env.go

@ -9,7 +9,7 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/wire"

@ -21,8 +21,9 @@ import (
"encoding/json"
"os"
"strconv"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
)

@ -24,8 +24,8 @@ import (
"strings"
"unicode"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
@ -81,7 +81,7 @@ func (self *DebuggerWindow) SetData(data string) {
func (self *DebuggerWindow) SetAsm(data []byte) {
self.win.Root().Call("clearAsm")
dis := chain.Disassemble(data)
dis := core.Disassemble(data)
for _, str := range dis {
self.win.Root().Call("setAsm", str)
}

@ -20,8 +20,8 @@ package main
import (
"encoding/json"
"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/event"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"
@ -45,12 +45,12 @@ type AppContainer interface {
type ExtApplication struct {
*xeth.JSXEth
eth chain.EthManager
eth core.EthManager
events event.Subscription
watcherQuitChan chan bool
filters map[string]*chain.Filter
filters map[string]*core.Filter
container AppContainer
lib *UiLib
@ -61,7 +61,7 @@ func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
JSXEth: xeth.NewJSXEth(lib.eth),
eth: lib.eth,
watcherQuitChan: make(chan bool),
filters: make(map[string]*chain.Filter),
filters: make(map[string]*core.Filter),
container: container,
lib: lib,
}
@ -81,7 +81,7 @@ func (app *ExtApplication) run() {
// Subscribe to events
mux := app.lib.eth.EventMux()
app.events = mux.Subscribe(chain.NewBlockEvent{}, state.Messages(nil))
app.events = mux.Subscribe(core.NewBlockEvent{}, state.Messages(nil))
// Call the main loop
go app.mainLoop()
@ -107,7 +107,7 @@ func (app *ExtApplication) stop() {
func (app *ExtApplication) mainLoop() {
for ev := range app.events.Chan() {
switch ev := ev.(type) {
case chain.NewBlockEvent:
case core.NewBlockEvent:
app.container.NewBlock(ev.Block)
case state.Messages:

@ -31,8 +31,8 @@ import (
"time"
"github.com/ethereum/go-ethereum"
"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/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
@ -413,9 +413,9 @@ func (gui *Gui) update() {
events := gui.eth.EventMux().Subscribe(
eth.ChainSyncEvent{},
eth.PeerListEvent{},
chain.NewBlockEvent{},
chain.TxPreEvent{},
chain.TxPostEvent{},
core.NewBlockEvent{},
core.TxPreEvent{},
core.TxPostEvent{},
)
// nameReg := gui.pipe.World().Config().Get("NameReg")
@ -430,13 +430,13 @@ func (gui *Gui) update() {
return
}
switch ev := ev.(type) {
case chain.NewBlockEvent:
case core.NewBlockEvent:
gui.processBlock(ev.Block, false)
if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 {
gui.setWalletValue(gui.eth.BlockManager().CurrentState().GetAccount(gui.address()).Balance(), nil)
}
case chain.TxPreEvent:
case core.TxPreEvent:
tx := ev.Tx
object := state.GetAccount(gui.address())
@ -449,7 +449,7 @@ func (gui *Gui) update() {
gui.setWalletValue(object.Balance(), unconfirmedFunds)
gui.insertTransaction("pre", tx)
case chain.TxPostEvent:
case core.TxPostEvent:
tx := ev.Tx
object := state.GetAccount(gui.address())

@ -26,7 +26,8 @@ import (
"os"
"path"
"path/filepath"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"

@ -20,7 +20,8 @@ package main
import (
"fmt"
"runtime"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"

@ -25,8 +25,8 @@ import (
"strings"
"github.com/ethereum/go-ethereum"
"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/javascript"
@ -231,7 +231,7 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) {
}
func (self *UiLib) NewFilterString(typ string) (id int) {
filter := chain.NewFilter(self.eth)
filter := core.NewFilter(self.eth)
filter.BlockCallback = func(block *types.Block) {
if self.win != nil && self.win.Root() != nil {
self.win.Root().Call("invokeFilterCallback", "{}", id)

@ -3,8 +3,8 @@ package utils
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"
)
@ -48,10 +48,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(caller vm.ClosureRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error) {

@ -1,4 +1,4 @@
package chain
package core
import (
"fmt"

@ -1,4 +1,4 @@
package chain
package core
import (
"bytes"
@ -9,7 +9,7 @@ import (
"sync"
"time"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"

@ -1,10 +1,10 @@
package chain
package core
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"

@ -1,4 +1,4 @@
package chain
package core
import (
"fmt"

@ -1,4 +1,4 @@
package chain
package core
import (
"hash"
@ -6,7 +6,7 @@ import (
"math/rand"
"time"
"github.com/ethereum/go-ethereum/chain/types"
"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"

@ -1,4 +1,4 @@
package chain
package core
import (
"math/big"

@ -1,4 +1,4 @@
package chain
package core
import (
"fmt"

@ -1,6 +1,6 @@
package chain
package core
import "github.com/ethereum/go-ethereum/chain/types"
import "github.com/ethereum/go-ethereum/core/types"
// TxPreEvent is posted when a transaction enters the transaction pool.
type TxPreEvent struct{ Tx *types.Transaction }

@ -1,4 +1,4 @@
package chain
package core
import (
"fmt"

@ -1,4 +1,4 @@
package chain
package core
import (
"math/big"

@ -1,11 +1,11 @@
package chain
package core
import (
"bytes"
"math"
"math/big"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
)

@ -1,4 +1,4 @@
package chain
package core
// import "testing"

@ -1,4 +1,4 @@
package chain
package core
import (
"math/big"

@ -1,4 +1,4 @@
package chain
package core
import (
"container/list"

@ -1,10 +1,10 @@
package chain
package core
import (
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)

@ -1,4 +1,4 @@
package chain
package core
import (
"bytes"
@ -7,7 +7,7 @@ import (
"math/big"
"sync"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/wire"

@ -1,9 +1,9 @@
package chain
package core
import (
"math/big"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)

@ -14,7 +14,7 @@ import (
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
@ -50,12 +50,12 @@ type Ethereum struct {
// DB interface
db ethutil.Database
// State manager for processing new blocks and managing the over all states
blockManager *chain.BlockManager
blockManager *core.BlockManager
// The transaction pool. Transaction can be pushed on this pool
// for later including in the blocks
txPool *chain.TxPool
txPool *core.TxPool
// The canonical chain
blockChain *chain.ChainManager
blockChain *core.ChainManager
// The block pool
blockPool *BlockPool
// Eventer
@ -94,7 +94,7 @@ type Ethereum struct {
filterMu sync.RWMutex
filterId int
filters map[int]*chain.Filter
filters map[int]*core.Filter
}
func New(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *crypto.KeyManager, caps Caps, usePnp bool) (*Ethereum, error) {
@ -124,13 +124,13 @@ func New(db ethutil.Database, clientIdentity wire.ClientIdentity, keyManager *cr
keyManager: keyManager,
clientIdentity: clientIdentity,
isUpToDate: true,
filters: make(map[int]*chain.Filter),
filters: make(map[int]*core.Filter),
}
ethereum.blockPool = NewBlockPool(ethereum)
ethereum.txPool = chain.NewTxPool(ethereum)
ethereum.blockChain = chain.NewChainManager(ethereum.EventMux())
ethereum.blockManager = chain.NewBlockManager(ethereum)
ethereum.txPool = core.NewTxPool(ethereum)
ethereum.blockChain = core.NewChainManager(ethereum.EventMux())
ethereum.blockManager = core.NewBlockManager(ethereum)
ethereum.blockChain.SetProcessor(ethereum.blockManager)
// Start the tx pool
@ -147,15 +147,15 @@ func (s *Ethereum) ClientIdentity() wire.ClientIdentity {
return s.clientIdentity
}
func (s *Ethereum) ChainManager() *chain.ChainManager {
func (s *Ethereum) ChainManager() *core.ChainManager {
return s.blockChain
}
func (s *Ethereum) BlockManager() *chain.BlockManager {
func (s *Ethereum) BlockManager() *core.BlockManager {
return s.blockManager
}
func (s *Ethereum) TxPool() *chain.TxPool {
func (s *Ethereum) TxPool() *core.TxPool {
return s.txPool
}
func (s *Ethereum) BlockPool() *BlockPool {
@ -591,7 +591,7 @@ out:
// InstallFilter adds filter for blockchain events.
// The filter's callbacks will run for matching blocks and messages.
// The filter should not be modified after it has been installed.
func (self *Ethereum) InstallFilter(filter *chain.Filter) (id int) {
func (self *Ethereum) InstallFilter(filter *core.Filter) (id int) {
self.filterMu.Lock()
id = self.filterId
self.filters[id] = filter
@ -608,7 +608,7 @@ func (self *Ethereum) UninstallFilter(id int) {
// GetFilter retrieves a filter installed using InstallFilter.
// The filter may not be modified.
func (self *Ethereum) GetFilter(id int) *chain.Filter {
func (self *Ethereum) GetFilter(id int) *core.Filter {
self.filterMu.RLock()
defer self.filterMu.RUnlock()
return self.filters[id]
@ -616,10 +616,10 @@ func (self *Ethereum) GetFilter(id int) *chain.Filter {
func (self *Ethereum) filterLoop() {
// Subscribe to events
events := self.eventMux.Subscribe(chain.NewBlockEvent{}, state.Messages(nil))
events := self.eventMux.Subscribe(core.NewBlockEvent{}, state.Messages(nil))
for event := range events.Chan() {
switch event := event.(type) {
case chain.NewBlockEvent:
case core.NewBlockEvent:
self.filterMu.RLock()
for _, filter := range self.filters {
if filter.BlockCallback != nil {

@ -8,9 +8,9 @@ import (
"path/filepath"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
@ -63,7 +63,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
// Subscribe to events
mux := ethereum.EventMux()
re.events = mux.Subscribe(chain.NewBlockEvent{})
re.events = mux.Subscribe(core.NewBlockEvent{})
// We have to make sure that, whoever calls this, calls "Stop"
go re.mainLoop()

@ -30,8 +30,8 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/ethutil"
"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/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/wire"
@ -59,7 +59,7 @@ type Miner struct {
localTxs map[int]*LocalTx
localTxId int
pow chain.PoW
pow core.PoW
quitCh chan struct{}
powQuitCh chan struct{}
@ -74,7 +74,7 @@ func New(coinbase []byte, eth *eth.Ethereum) *Miner {
return &Miner{
eth: eth,
powQuitCh: make(chan struct{}),
pow: &chain.EasyPow{},
pow: &core.EasyPow{},
mining: false,
localTxs: make(map[int]*LocalTx),
MinAcceptedGasPrice: big.NewInt(10000000000000),
@ -82,7 +82,7 @@ func New(coinbase []byte, eth *eth.Ethereum) *Miner {
}
}
func (self *Miner) GetPow() chain.PoW {
func (self *Miner) GetPow() core.PoW {
return self.pow
}
@ -116,7 +116,7 @@ func (self *Miner) Start() {
self.powQuitCh = make(chan struct{})
mux := self.eth.EventMux()
self.events = mux.Subscribe(chain.NewBlockEvent{}, chain.TxPreEvent{}, &LocalTx{})
self.events = mux.Subscribe(core.NewBlockEvent{}, core.TxPreEvent{}, &LocalTx{})
go self.update()
go self.mine()
@ -147,7 +147,7 @@ out:
select {
case event := <-self.events.Chan():
switch event := event.(type) {
case chain.NewBlockEvent:
case core.NewBlockEvent:
block := event.Block
if self.eth.ChainManager().HasBlock(block.Hash()) {
self.reset()
@ -156,7 +156,7 @@ out:
} else if true {
// do uncle stuff
}
case chain.TxPreEvent, *LocalTx:
case core.TxPreEvent, *LocalTx:
self.reset()
go self.mine()
}

@ -12,7 +12,7 @@ import (
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/wire"

@ -1,12 +1,12 @@
package ui
import (
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/ethutil"
)
func NewFilterFromMap(object map[string]interface{}, eth chain.EthManager) *chain.Filter {
filter := chain.NewFilter(eth)
func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.Filter {
filter := core.NewFilter(eth)
if object["earliest"] != nil {
val := ethutil.NewValue(object["earliest"])
@ -46,7 +46,7 @@ func NewFilterFromMap(object map[string]interface{}, eth chain.EthManager) *chai
}
// Conversion methodn
func mapToAccountChange(m map[string]interface{}) (d chain.AccountChange) {
func mapToAccountChange(m map[string]interface{}) (d core.AccountChange) {
if str, ok := m["id"].(string); ok {
d.Address = ethutil.Hex2Bytes(str)
}
@ -60,9 +60,9 @@ func mapToAccountChange(m map[string]interface{}) (d chain.AccountChange) {
// data can come in in the following formats:
// ["aabbccdd", {id: "ccddee", at: "11223344"}], "aabbcc", {id: "ccddee", at: "1122"}
func makeAltered(v interface{}) (d []chain.AccountChange) {
func makeAltered(v interface{}) (d []core.AccountChange) {
if str, ok := v.(string); ok {
d = append(d, chain.AccountChange{ethutil.Hex2Bytes(str), nil})
d = append(d, core.AccountChange{ethutil.Hex2Bytes(str), nil})
} else if obj, ok := v.(map[string]interface{}); ok {
d = append(d, mapToAccountChange(obj))
} else if slice, ok := v.([]interface{}); ok {

@ -3,12 +3,12 @@ package qt
import (
"fmt"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/ui"
"gopkg.in/qml.v1"
)
func NewFilterFromMap(object map[string]interface{}, eth chain.EthManager) *chain.Filter {
func NewFilterFromMap(object map[string]interface{}, eth core.EthManager) *core.Filter {
filter := ui.NewFilterFromMap(object, eth)
if object["altered"] != nil {
@ -18,7 +18,7 @@ func NewFilterFromMap(object map[string]interface{}, eth chain.EthManager) *chai
return filter
}
func makeAltered(v interface{}) (d []chain.AccountChange) {
func makeAltered(v interface{}) (d []core.AccountChange) {
if qList, ok := v.(*qml.List); ok {
var s []interface{}
qList.Convert(&s)

@ -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
}

@ -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) {

Loading…
Cancel
Save