diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-04 17:28:02 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-04 17:28:02 +0800 |
commit | 9008b155d3c8d2a32c4c8945f1174243d48d4e90 (patch) | |
tree | a55140b7d4802a0db14cbc265b8ca21d44d6f10a | |
parent | b6cb5272de96185b424d5c6c4a817d99f536d29b (diff) | |
download | dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.gz dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.bz2 dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.lz dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.xz dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.tar.zst dexon-9008b155d3c8d2a32c4c8945f1174243d48d4e90.zip |
Renamed `chain` => `core`
-rw-r--r-- | block_pool.go | 2 | ||||
-rw-r--r-- | cmd/mist/bindings.go | 3 | ||||
-rw-r--r-- | cmd/mist/debugger.go | 4 | ||||
-rw-r--r-- | cmd/mist/ext_app.go | 14 | ||||
-rw-r--r-- | cmd/mist/gui.go | 16 | ||||
-rw-r--r-- | cmd/mist/html_container.go | 3 | ||||
-rw-r--r-- | cmd/mist/qml_container.go | 3 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 6 | ||||
-rw-r--r-- | cmd/utils/vm_env.go | 8 | ||||
-rw-r--r-- | core/.gitignore (renamed from chain/.gitignore) | 0 | ||||
-rw-r--r-- | core/asm.go (renamed from chain/asm.go) | 2 | ||||
-rw-r--r-- | core/block_manager.go (renamed from chain/block_manager.go) | 4 | ||||
-rw-r--r-- | core/chain_manager.go (renamed from chain/chain_manager.go) | 4 | ||||
-rw-r--r-- | core/chain_manager_test.go (renamed from chain/chain_manager_test.go) | 2 | ||||
-rw-r--r-- | core/dagger.go (renamed from chain/dagger.go) | 4 | ||||
-rw-r--r-- | core/dagger_test.go (renamed from chain/dagger_test.go) | 2 | ||||
-rw-r--r-- | core/error.go (renamed from chain/error.go) | 2 | ||||
-rw-r--r-- | core/events.go (renamed from chain/events.go) | 4 | ||||
-rw-r--r-- | core/execution.go (renamed from chain/execution.go) | 2 | ||||
-rw-r--r-- | core/fees.go (renamed from chain/fees.go) | 2 | ||||
-rw-r--r-- | core/filter.go (renamed from chain/filter.go) | 4 | ||||
-rw-r--r-- | core/filter_test.go (renamed from chain/filter_test.go) | 2 | ||||
-rw-r--r-- | core/genesis.go (renamed from chain/genesis.go) | 2 | ||||
-rw-r--r-- | core/helper_test.go (renamed from chain/helper_test.go) | 2 | ||||
-rw-r--r-- | core/state_transition.go (renamed from chain/state_transition.go) | 4 | ||||
-rw-r--r-- | core/transaction_pool.go (renamed from chain/transaction_pool.go) | 4 | ||||
-rw-r--r-- | core/types/block.go (renamed from chain/types/block.go) | 0 | ||||
-rw-r--r-- | core/types/bloom9.go (renamed from chain/types/bloom9.go) | 0 | ||||
-rw-r--r-- | core/types/bloom9_test.go (renamed from chain/types/bloom9_test.go) | 0 | ||||
-rw-r--r-- | core/types/common.go (renamed from chain/types/common.go) | 0 | ||||
-rw-r--r-- | core/types/derive_sha.go (renamed from chain/types/derive_sha.go) | 0 | ||||
-rw-r--r-- | core/types/receipt.go (renamed from chain/types/receipt.go) | 0 | ||||
-rw-r--r-- | core/types/transaction.go (renamed from chain/types/transaction.go) | 0 | ||||
-rw-r--r-- | core/types/transaction_test.go (renamed from chain/types/transaction_test.go) | 0 | ||||
-rw-r--r-- | core/vm_env.go (renamed from chain/vm_env.go) | 4 | ||||
-rw-r--r-- | ethereum.go | 32 | ||||
-rw-r--r-- | javascript/javascript_runtime.go | 6 | ||||
-rw-r--r-- | miner/miner.go | 16 | ||||
-rw-r--r-- | peer.go | 2 | ||||
-rw-r--r-- | ui/filter.go | 12 | ||||
-rw-r--r-- | ui/qt/filter.go | 6 | ||||
-rw-r--r-- | xeth/hexface.go | 59 | ||||
-rw-r--r-- | xeth/js_types.go | 10 | ||||
-rw-r--r-- | xeth/pipe.go | 12 | ||||
-rw-r--r-- | xeth/vm_env.go | 8 |
45 files changed, 112 insertions, 160 deletions
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 index f725d58d1..f725d58d1 100644 --- a/chain/.gitignore +++ b/core/.gitignore diff --git a/chain/asm.go b/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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 index feab7072f..feab7072f 100644 --- a/chain/types/block.go +++ b/core/types/block.go diff --git a/chain/types/bloom9.go b/core/types/bloom9.go index 77aa6eef5..77aa6eef5 100644 --- a/chain/types/bloom9.go +++ b/core/types/bloom9.go diff --git a/chain/types/bloom9_test.go b/core/types/bloom9_test.go index 74e00cac6..74e00cac6 100644 --- a/chain/types/bloom9_test.go +++ b/core/types/bloom9_test.go diff --git a/chain/types/common.go b/core/types/common.go index ba88b77e1..ba88b77e1 100644 --- a/chain/types/common.go +++ b/core/types/common.go diff --git a/chain/types/derive_sha.go b/core/types/derive_sha.go index 1897ff198..1897ff198 100644 --- a/chain/types/derive_sha.go +++ b/core/types/derive_sha.go diff --git a/chain/types/receipt.go b/core/types/receipt.go index 25fa8fb07..25fa8fb07 100644 --- a/chain/types/receipt.go +++ b/core/types/receipt.go diff --git a/chain/types/transaction.go b/core/types/transaction.go index efc90b6f2..efc90b6f2 100644 --- a/chain/types/transaction.go +++ b/core/types/transaction.go diff --git a/chain/types/transaction_test.go b/core/types/transaction_test.go index ab1254f4c..ab1254f4c 100644 --- a/chain/types/transaction_test.go +++ b/core/types/transaction_test.go diff --git a/chain/vm_env.go b/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() } @@ -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) { |