diff --git a/block_pool.go b/block_pool.go index bb459cc7d1..95c766e531 100644 --- a/block_pool.go +++ b/block_pool.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" diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index a605cb03af..6dbcc3f1de 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -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" ) diff --git a/cmd/mist/debugger.go b/cmd/mist/debugger.go index 407c9353a8..06ff6b8ccd 100644 --- a/cmd/mist/debugger.go +++ b/cmd/mist/debugger.go @@ -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) } diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index 22fa4bfaff..33c420a7a1 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -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: diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index 61b66cce3e..e58e349d17 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -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()) diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 4c6609a95e..b3fc219fad 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -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" diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index b5986c16eb..a0a46f9b10 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -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" diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index a0786cf2f3..2b5e566465 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -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) diff --git a/cmd/utils/vm_env.go b/cmd/utils/vm_env.go index c8744076e3..7c97e1a72c 100644 --- a/cmd/utils/vm_env.go +++ b/cmd/utils/vm_env.go @@ -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) { diff --git a/chain/.gitignore b/core/.gitignore similarity index 100% rename from chain/.gitignore rename to core/.gitignore diff --git a/chain/asm.go b/core/asm.go similarity index 98% rename from chain/asm.go rename to core/asm.go index 5a2e961acc..a8b3023f42 100644 --- a/chain/asm.go +++ b/core/asm.go @@ -1,4 +1,4 @@ -package chain +package core import ( "fmt" diff --git a/chain/block_manager.go b/core/block_manager.go similarity index 99% rename from chain/block_manager.go rename to core/block_manager.go index eda8a5a0c6..f0b78b675b 100644 --- a/chain/block_manager.go +++ b/core/block_manager.go @@ -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" diff --git a/chain/chain_manager.go b/core/chain_manager.go similarity index 99% rename from chain/chain_manager.go rename to core/chain_manager.go index 9b35ce08ab..7acd171ecc 100644 --- a/chain/chain_manager.go +++ b/core/chain_manager.go @@ -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" diff --git a/chain/chain_manager_test.go b/core/chain_manager_test.go similarity index 99% rename from chain/chain_manager_test.go rename to core/chain_manager_test.go index 0314914a9f..51e70fb12c 100644 --- a/chain/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -1,4 +1,4 @@ -package chain +package core import ( "fmt" diff --git a/chain/dagger.go b/core/dagger.go similarity index 98% rename from chain/dagger.go rename to core/dagger.go index 5078503890..8a042b34ff 100644 --- a/chain/dagger.go +++ b/core/dagger.go @@ -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" diff --git a/chain/dagger_test.go b/core/dagger_test.go similarity index 96% rename from chain/dagger_test.go rename to core/dagger_test.go index b40cd9742e..e80064e6bf 100644 --- a/chain/dagger_test.go +++ b/core/dagger_test.go @@ -1,4 +1,4 @@ -package chain +package core import ( "math/big" diff --git a/chain/error.go b/core/error.go similarity index 99% rename from chain/error.go rename to core/error.go index 0c4d6e59ed..11d8c16537 100644 --- a/chain/error.go +++ b/core/error.go @@ -1,4 +1,4 @@ -package chain +package core import ( "fmt" diff --git a/chain/events.go b/core/events.go similarity index 83% rename from chain/events.go rename to core/events.go index 06ab6be799..deeba3e982 100644 --- a/chain/events.go +++ b/core/events.go @@ -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 } diff --git a/chain/execution.go b/core/execution.go similarity index 99% rename from chain/execution.go rename to core/execution.go index 932ffa868e..9f9d9a5d9e 100644 --- a/chain/execution.go +++ b/core/execution.go @@ -1,4 +1,4 @@ -package chain +package core import ( "fmt" diff --git a/chain/fees.go b/core/fees.go similarity index 83% rename from chain/fees.go rename to core/fees.go index 4df6d365d8..bbce01b84b 100644 --- a/chain/fees.go +++ b/core/fees.go @@ -1,4 +1,4 @@ -package chain +package core import ( "math/big" diff --git a/chain/filter.go b/core/filter.go similarity index 98% rename from chain/filter.go rename to core/filter.go index bb8db38a54..fe3665bf39 100644 --- a/chain/filter.go +++ b/core/filter.go @@ -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" ) diff --git a/chain/filter_test.go b/core/filter_test.go similarity index 87% rename from chain/filter_test.go rename to core/filter_test.go index c63bb5a2d6..d53b835b7e 100644 --- a/chain/filter_test.go +++ b/core/filter_test.go @@ -1,4 +1,4 @@ -package chain +package core // import "testing" diff --git a/chain/genesis.go b/core/genesis.go similarity index 98% rename from chain/genesis.go rename to core/genesis.go index 85e85d1edb..707154759a 100644 --- a/chain/genesis.go +++ b/core/genesis.go @@ -1,4 +1,4 @@ -package chain +package core import ( "math/big" diff --git a/chain/helper_test.go b/core/helper_test.go similarity index 99% rename from chain/helper_test.go rename to core/helper_test.go index 8c7532111a..2b1510ea49 100644 --- a/chain/helper_test.go +++ b/core/helper_test.go @@ -1,4 +1,4 @@ -package chain +package core import ( "container/list" diff --git a/chain/state_transition.go b/core/state_transition.go similarity index 98% rename from chain/state_transition.go rename to core/state_transition.go index b2ba4f22a5..e3eea57ded 100644 --- a/chain/state_transition.go +++ b/core/state_transition.go @@ -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" ) diff --git a/chain/transaction_pool.go b/core/transaction_pool.go similarity index 98% rename from chain/transaction_pool.go rename to core/transaction_pool.go index ad89c0a987..2a14e48b2c 100644 --- a/chain/transaction_pool.go +++ b/core/transaction_pool.go @@ -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" diff --git a/chain/types/block.go b/core/types/block.go similarity index 100% rename from chain/types/block.go rename to core/types/block.go diff --git a/chain/types/bloom9.go b/core/types/bloom9.go similarity index 100% rename from chain/types/bloom9.go rename to core/types/bloom9.go diff --git a/chain/types/bloom9_test.go b/core/types/bloom9_test.go similarity index 100% rename from chain/types/bloom9_test.go rename to core/types/bloom9_test.go diff --git a/chain/types/common.go b/core/types/common.go similarity index 100% rename from chain/types/common.go rename to core/types/common.go diff --git a/chain/types/derive_sha.go b/core/types/derive_sha.go similarity index 100% rename from chain/types/derive_sha.go rename to core/types/derive_sha.go diff --git a/chain/types/receipt.go b/core/types/receipt.go similarity index 100% rename from chain/types/receipt.go rename to core/types/receipt.go diff --git a/chain/types/transaction.go b/core/types/transaction.go similarity index 100% rename from chain/types/transaction.go rename to core/types/transaction.go diff --git a/chain/types/transaction_test.go b/core/types/transaction_test.go similarity index 100% rename from chain/types/transaction_test.go rename to core/types/transaction_test.go diff --git a/chain/vm_env.go b/core/vm_env.go similarity index 97% rename from chain/vm_env.go rename to core/vm_env.go index c2428c2344..17686b28f2 100644 --- a/chain/vm_env.go +++ b/core/vm_env.go @@ -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" ) diff --git a/ethereum.go b/ethereum.go index 530d26fce6..94e46b5562 100644 --- a/ethereum.go +++ b/ethereum.go @@ -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 { diff --git a/javascript/javascript_runtime.go b/javascript/javascript_runtime.go index e8b785f50f..0aa376a0a5 100644 --- a/javascript/javascript_runtime.go +++ b/javascript/javascript_runtime.go @@ -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() diff --git a/miner/miner.go b/miner/miner.go index c39de18e31..589144c0c7 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -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() } diff --git a/peer.go b/peer.go index ed908265a9..0d48faa1eb 100644 --- a/peer.go +++ b/peer.go @@ -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" diff --git a/ui/filter.go b/ui/filter.go index 84209861ea..88faad5caa 100644 --- a/ui/filter.go +++ b/ui/filter.go @@ -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 { diff --git a/ui/qt/filter.go b/ui/qt/filter.go index 96c3ab3a32..c689364016 100644 --- a/ui/qt/filter.go +++ b/ui/qt/filter.go @@ -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) diff --git a/xeth/hexface.go b/xeth/hexface.go index 6360c76752..c1f49453d7 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 cba674416a..6aba3d993d 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 2dfb91b7f7..cabcc1cbe3 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 d114596266..831a310cce 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) {