From 9008b155d3c8d2a32c4c8945f1174243d48d4e90 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 4 Dec 2014 10:28:02 +0100 Subject: [PATCH] Renamed `chain` => `core` --- block_pool.go | 2 +- cmd/mist/bindings.go | 3 +- cmd/mist/debugger.go | 4 +- cmd/mist/ext_app.go | 14 +++--- cmd/mist/gui.go | 16 +++--- cmd/mist/html_container.go | 3 +- cmd/mist/qml_container.go | 3 +- cmd/mist/ui_lib.go | 6 +-- cmd/utils/vm_env.go | 8 +-- {chain => core}/.gitignore | 0 {chain => core}/asm.go | 2 +- {chain => core}/block_manager.go | 4 +- {chain => core}/chain_manager.go | 4 +- {chain => core}/chain_manager_test.go | 2 +- {chain => core}/dagger.go | 4 +- {chain => core}/dagger_test.go | 2 +- {chain => core}/error.go | 2 +- {chain => core}/events.go | 4 +- {chain => core}/execution.go | 2 +- {chain => core}/fees.go | 2 +- {chain => core}/filter.go | 4 +- {chain => core}/filter_test.go | 2 +- {chain => core}/genesis.go | 2 +- {chain => core}/helper_test.go | 2 +- {chain => core}/state_transition.go | 4 +- {chain => core}/transaction_pool.go | 4 +- {chain => core}/types/block.go | 0 {chain => core}/types/bloom9.go | 0 {chain => core}/types/bloom9_test.go | 0 {chain => core}/types/common.go | 0 {chain => core}/types/derive_sha.go | 0 {chain => core}/types/receipt.go | 0 {chain => core}/types/transaction.go | 0 {chain => core}/types/transaction_test.go | 0 {chain => core}/vm_env.go | 4 +- ethereum.go | 32 ++++++------ javascript/javascript_runtime.go | 6 +-- miner/miner.go | 16 +++--- peer.go | 2 +- ui/filter.go | 12 ++--- ui/qt/filter.go | 6 +-- xeth/hexface.go | 59 ++--------------------- xeth/js_types.go | 10 ++-- xeth/pipe.go | 12 ++--- xeth/vm_env.go | 8 +-- 45 files changed, 112 insertions(+), 160 deletions(-) rename {chain => core}/.gitignore (100%) rename {chain => core}/asm.go (98%) rename {chain => core}/block_manager.go (99%) rename {chain => core}/chain_manager.go (99%) rename {chain => core}/chain_manager_test.go (99%) rename {chain => core}/dagger.go (98%) rename {chain => core}/dagger_test.go (96%) rename {chain => core}/error.go (99%) rename {chain => core}/events.go (83%) rename {chain => core}/execution.go (99%) rename {chain => core}/fees.go (83%) rename {chain => core}/filter.go (98%) rename {chain => core}/filter_test.go (87%) rename {chain => core}/genesis.go (98%) rename {chain => core}/helper_test.go (99%) rename {chain => core}/state_transition.go (98%) rename {chain => core}/transaction_pool.go (98%) rename {chain => core}/types/block.go (100%) rename {chain => core}/types/bloom9.go (100%) rename {chain => core}/types/bloom9_test.go (100%) rename {chain => core}/types/common.go (100%) rename {chain => core}/types/derive_sha.go (100%) rename {chain => core}/types/receipt.go (100%) rename {chain => core}/types/transaction.go (100%) rename {chain => core}/types/transaction_test.go (100%) rename {chain => core}/vm_env.go (97%) diff --git a/block_pool.go b/block_pool.go index bb459cc7d..95c766e53 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 a605cb03a..6dbcc3f1d 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 407c9353a..06ff6b8cc 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 22fa4bfaf..33c420a7a 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 61b66cce3..e58e349d1 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 4c6609a95..b3fc219fa 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 b5986c16e..a0a46f9b1 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 a0786cf2f..2b5e56646 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 c8744076e..7c97e1a72 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 5a2e961ac..a8b3023f4 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 eda8a5a0c..f0b78b675 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 9b35ce08a..7acd171ec 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 0314914a9..51e70fb12 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 507850389..8a042b34f 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 b40cd9742..e80064e6b 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 0c4d6e59e..11d8c1653 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 06ab6be79..deeba3e98 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 932ffa868..9f9d9a5d9 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 4df6d365d..bbce01b84 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 bb8db38a5..fe3665bf3 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 c63bb5a2d..d53b835b7 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 85e85d1ed..707154759 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 8c7532111..2b1510ea4 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 b2ba4f22a..e3eea57de 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 ad89c0a98..2a14e48b2 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 c2428c234..17686b28f 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 530d26fce..94e46b556 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 e8b785f50..0aa376a0a 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 c39de18e3..589144c0c 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 ed908265a..0d48faa1e 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 84209861e..88faad5ca 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 96c3ab3a3..c68936401 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 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) {