Moved ethchain to chain

This commit is contained in:
obscuren 2014-10-31 10:59:17 +01:00
parent 8e0a39f33f
commit 3ee0461cb5
47 changed files with 142 additions and 142 deletions

@ -9,7 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/ethwire"
@ -20,7 +20,7 @@ var poollogger = ethlog.NewLogger("BPOOL")
type block struct { type block struct {
from *Peer from *Peer
peer *Peer peer *Peer
block *ethchain.Block block *chain.Block
reqAt time.Time reqAt time.Time
requested int requested int
} }
@ -73,7 +73,7 @@ func (self *BlockPool) HasCommonHash(hash []byte) bool {
return self.eth.ChainManager().GetBlock(hash) != nil return self.eth.ChainManager().GetBlock(hash) != nil
} }
func (self *BlockPool) Blocks() (blocks ethchain.Blocks) { func (self *BlockPool) Blocks() (blocks chain.Blocks) {
for _, item := range self.pool { for _, item := range self.pool {
if item.block != nil { if item.block != nil {
blocks = append(blocks, item.block) blocks = append(blocks, item.block)
@ -123,15 +123,15 @@ func (self *BlockPool) AddHash(hash []byte, peer *Peer) {
} }
} }
func (self *BlockPool) Add(b *ethchain.Block, peer *Peer) { func (self *BlockPool) Add(b *chain.Block, peer *Peer) {
self.addBlock(b, peer, false) self.addBlock(b, peer, false)
} }
func (self *BlockPool) AddNew(b *ethchain.Block, peer *Peer) { func (self *BlockPool) AddNew(b *chain.Block, peer *Peer) {
self.addBlock(b, peer, true) self.addBlock(b, peer, true)
} }
func (self *BlockPool) addBlock(b *ethchain.Block, peer *Peer, newBlock bool) { func (self *BlockPool) addBlock(b *chain.Block, peer *Peer, newBlock bool) {
self.mut.Lock() self.mut.Lock()
defer self.mut.Unlock() defer self.mut.Unlock()
@ -262,7 +262,7 @@ out:
/* /*
if !self.fetchingHashes { if !self.fetchingHashes {
blocks := self.Blocks() blocks := self.Blocks()
ethchain.BlockBy(ethchain.Number).Sort(blocks) chain.BlockBy(chain.Number).Sort(blocks)
if len(blocks) > 0 { if len(blocks) > 0 {
if !self.eth.ChainManager().HasBlock(b.PrevHash) && self.pool[string(b.PrevHash)] == nil && !self.fetchingHashes { if !self.eth.ChainManager().HasBlock(b.PrevHash) && self.pool[string(b.PrevHash)] == nil && !self.fetchingHashes {
@ -283,7 +283,7 @@ out:
break out break out
case <-procTimer.C: case <-procTimer.C:
blocks := self.Blocks() blocks := self.Blocks()
ethchain.BlockBy(ethchain.Number).Sort(blocks) chain.BlockBy(chain.Number).Sort(blocks)
// Find common block // Find common block
for i, block := range blocks { for i, block := range blocks {

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

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"bytes" "bytes"

@ -1,4 +1,4 @@
package ethchain package chain
type BloomFilter struct { type BloomFilter struct {
bin []byte bin []byte

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

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"testing" "testing"

@ -1,4 +1,4 @@
package ethchain package chain
import "testing" import "testing"

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"bytes" "bytes"

@ -0,0 +1 @@
package chain

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"hash" "hash"

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

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"github.com/ethereum/go-ethereum/ethtrie" "github.com/ethereum/go-ethereum/ethtrie"

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

@ -1,4 +1,4 @@
package ethchain package chain
// TxPreEvent is posted when a transaction enters the transaction pool. // TxPreEvent is posted when a transaction enters the transaction pool.
type TxPreEvent struct{ Tx *Transaction } type TxPreEvent struct{ Tx *Transaction }

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

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"bytes" "bytes"

@ -1,4 +1,4 @@
package ethchain package chain
import "testing" import "testing"

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

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

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"bytes" "bytes"

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

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"bytes" "bytes"

@ -1,4 +1,4 @@
package ethchain package chain
import ( import (
"bytes" "bytes"

@ -0,0 +1 @@
package chain

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

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

@ -22,7 +22,7 @@ import (
"os" "os"
"strconv" "strconv"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
@ -110,7 +110,7 @@ func (self *Gui) DumpState(hash, path string) {
if len(hash) == 0 { if len(hash) == 0 {
stateDump = self.eth.StateManager().CurrentState().Dump() stateDump = self.eth.StateManager().CurrentState().Dump()
} else { } else {
var block *ethchain.Block var block *chain.Block
if hash[0] == '#' { if hash[0] == '#' {
i, _ := strconv.Atoi(hash[1:]) i, _ := strconv.Atoi(hash[1:])
block = self.eth.ChainManager().GetBlockByNumber(uint64(i)) block = self.eth.ChainManager().GetBlockByNumber(uint64(i))

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

@ -20,7 +20,7 @@ package main
import ( import (
"encoding/json" "encoding/json"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
@ -36,7 +36,7 @@ type AppContainer interface {
Window() *qml.Window Window() *qml.Window
Engine() *qml.Engine Engine() *qml.Engine
NewBlock(*ethchain.Block) NewBlock(*chain.Block)
NewWatcher(chan bool) NewWatcher(chan bool)
Messages(ethstate.Messages, string) Messages(ethstate.Messages, string)
Post(string, int) Post(string, int)
@ -44,12 +44,12 @@ type AppContainer interface {
type ExtApplication struct { type ExtApplication struct {
*ethpipe.JSPipe *ethpipe.JSPipe
eth ethchain.EthManager eth chain.EthManager
events event.Subscription events event.Subscription
watcherQuitChan chan bool watcherQuitChan chan bool
filters map[string]*ethchain.Filter filters map[string]*chain.Filter
container AppContainer container AppContainer
lib *UiLib lib *UiLib
@ -60,7 +60,7 @@ func NewExtApplication(container AppContainer, lib *UiLib) *ExtApplication {
JSPipe: ethpipe.NewJSPipe(lib.eth), JSPipe: ethpipe.NewJSPipe(lib.eth),
eth: lib.eth, eth: lib.eth,
watcherQuitChan: make(chan bool), watcherQuitChan: make(chan bool),
filters: make(map[string]*ethchain.Filter), filters: make(map[string]*chain.Filter),
container: container, container: container,
lib: lib, lib: lib,
} }
@ -80,7 +80,7 @@ func (app *ExtApplication) run() {
// Subscribe to events // Subscribe to events
mux := app.lib.eth.EventMux() mux := app.lib.eth.EventMux()
app.events = mux.Subscribe(ethchain.NewBlockEvent{}, ethstate.Messages(nil)) app.events = mux.Subscribe(chain.NewBlockEvent{}, ethstate.Messages(nil))
// Call the main loop // Call the main loop
go app.mainLoop() go app.mainLoop()
@ -106,7 +106,7 @@ func (app *ExtApplication) stop() {
func (app *ExtApplication) mainLoop() { func (app *ExtApplication) mainLoop() {
for ev := range app.events.Chan() { for ev := range app.events.Chan() {
switch ev := ev.(type) { switch ev := ev.(type) {
case ethchain.NewBlockEvent: case chain.NewBlockEvent:
app.container.NewBlock(ev.Block) app.container.NewBlock(ev.Block)
case ethstate.Messages: case ethstate.Messages:

@ -31,7 +31,7 @@ import (
"time" "time"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethminer"
@ -286,7 +286,7 @@ func (gui *Gui) loadAddressBook() {
} }
} }
func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) { func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) {
pipe := ethpipe.New(gui.eth) pipe := ethpipe.New(gui.eth)
nameReg := pipe.World().Config().Get("NameReg") nameReg := pipe.World().Config().Get("NameReg")
addr := gui.address() addr := gui.address()
@ -336,7 +336,7 @@ func (gui *Gui) insertTransaction(window string, tx *ethchain.Transaction) {
func (gui *Gui) readPreviousTransactions() { func (gui *Gui) readPreviousTransactions() {
it := gui.txDb.Db().NewIterator(nil, nil) it := gui.txDb.Db().NewIterator(nil, nil)
for it.Next() { for it.Next() {
tx := ethchain.NewTransactionFromBytes(it.Value()) tx := chain.NewTransactionFromBytes(it.Value())
gui.insertTransaction("post", tx) gui.insertTransaction("post", tx)
@ -344,7 +344,7 @@ func (gui *Gui) readPreviousTransactions() {
it.Release() it.Release()
} }
func (gui *Gui) processBlock(block *ethchain.Block, initial bool) { func (gui *Gui) processBlock(block *chain.Block, initial bool) {
name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00") name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00")
b := ethpipe.NewJSBlock(block) b := ethpipe.NewJSBlock(block)
b.Name = name b.Name = name
@ -407,9 +407,9 @@ func (gui *Gui) update() {
events := gui.eth.EventMux().Subscribe( events := gui.eth.EventMux().Subscribe(
eth.ChainSyncEvent{}, eth.ChainSyncEvent{},
eth.PeerListEvent{}, eth.PeerListEvent{},
ethchain.NewBlockEvent{}, chain.NewBlockEvent{},
ethchain.TxPreEvent{}, chain.TxPreEvent{},
ethchain.TxPostEvent{}, chain.TxPostEvent{},
ethminer.Event{}, ethminer.Event{},
) )
@ -425,13 +425,13 @@ func (gui *Gui) update() {
return return
} }
switch ev := ev.(type) { switch ev := ev.(type) {
case ethchain.NewBlockEvent: case chain.NewBlockEvent:
gui.processBlock(ev.Block, false) gui.processBlock(ev.Block, false)
if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 { if bytes.Compare(ev.Block.Coinbase, gui.address()) == 0 {
gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil) gui.setWalletValue(gui.eth.StateManager().CurrentState().GetAccount(gui.address()).Balance(), nil)
} }
case ethchain.TxPreEvent: case chain.TxPreEvent:
tx := ev.Tx tx := ev.Tx
object := state.GetAccount(gui.address()) object := state.GetAccount(gui.address())
@ -444,7 +444,7 @@ func (gui *Gui) update() {
gui.setWalletValue(object.Balance(), unconfirmedFunds) gui.setWalletValue(object.Balance(), unconfirmedFunds)
gui.insertTransaction("pre", tx) gui.insertTransaction("pre", tx)
case ethchain.TxPostEvent: case chain.TxPostEvent:
tx := ev.Tx tx := ev.Tx
object := state.GetAccount(gui.address()) object := state.GetAccount(gui.address())

@ -27,7 +27,7 @@ import (
"path" "path"
"path/filepath" "path/filepath"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
@ -138,7 +138,7 @@ func (app *HtmlApplication) Window() *qml.Window {
return app.win return app.win
} }
func (app *HtmlApplication) NewBlock(block *ethchain.Block) { func (app *HtmlApplication) NewBlock(block *chain.Block) {
b := &ethpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} b := &ethpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())}
app.webView.Call("onNewBlockCb", b) app.webView.Call("onNewBlockCb", b)
} }

@ -21,7 +21,7 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
@ -65,7 +65,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
} }
// Events // Events
func (app *QmlApplication) NewBlock(block *ethchain.Block) { func (app *QmlApplication) NewBlock(block *chain.Block) {
pblock := &ethpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())} pblock := &ethpipe.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())}
app.win.Call("onNewBlockCb", pblock) app.win.Call("onNewBlockCb", pblock)
} }

@ -25,7 +25,7 @@ import (
"strings" "strings"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto" "github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
@ -120,7 +120,7 @@ func (self *UiLib) PastPeers() *ethutil.List {
} }
func (self *UiLib) ImportTx(rlpTx string) { func (self *UiLib) ImportTx(rlpTx string) {
tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx)) tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
self.eth.TxPool().QueueTransaction(tx) self.eth.TxPool().QueueTransaction(tx)
} }
@ -221,8 +221,8 @@ func (self *UiLib) NewFilter(object map[string]interface{}) (id int) {
} }
func (self *UiLib) NewFilterString(typ string) (id int) { func (self *UiLib) NewFilterString(typ string) (id int) {
filter := ethchain.NewFilter(self.eth) filter := chain.NewFilter(self.eth)
filter.BlockCallback = func(block *ethchain.Block) { filter.BlockCallback = func(block *chain.Block) {
self.win.Root().Call("invokeFilterCallback", "{}", id) self.win.Root().Call("invokeFilterCallback", "{}", id)
} }
id = self.eth.InstallFilter(filter) id = self.eth.InstallFilter(filter)

@ -1 +0,0 @@
package ethchain

@ -1 +0,0 @@
package ethchain

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

@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"sort" "sort"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/ethwire"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
@ -13,12 +13,12 @@ import (
var logger = ethlog.NewLogger("MINER") var logger = ethlog.NewLogger("MINER")
type Miner struct { type Miner struct {
pow ethchain.PoW pow chain.PoW
ethereum ethchain.EthManager ethereum chain.EthManager
coinbase []byte coinbase []byte
txs ethchain.Transactions txs chain.Transactions
uncles []*ethchain.Block uncles []*chain.Block
block *ethchain.Block block *chain.Block
events event.Subscription events event.Subscription
powQuitChan chan struct{} powQuitChan chan struct{}
@ -37,13 +37,13 @@ type Event struct {
Miner *Miner Miner *Miner
} }
func (self *Miner) GetPow() ethchain.PoW { func (self *Miner) GetPow() chain.PoW {
return self.pow return self.pow
} }
func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) *Miner { func NewDefaultMiner(coinbase []byte, ethereum chain.EthManager) *Miner {
miner := Miner{ miner := Miner{
pow: &ethchain.EasyPow{}, pow: &chain.EasyPow{},
ethereum: ethereum, ethereum: ethereum,
coinbase: coinbase, coinbase: coinbase,
} }
@ -64,7 +64,7 @@ func (miner *Miner) Start() {
miner.block = miner.ethereum.ChainManager().NewBlock(miner.coinbase) miner.block = miner.ethereum.ChainManager().NewBlock(miner.coinbase)
mux := miner.ethereum.EventMux() mux := miner.ethereum.EventMux()
miner.events = mux.Subscribe(ethchain.NewBlockEvent{}, ethchain.TxPreEvent{}) miner.events = mux.Subscribe(chain.NewBlockEvent{}, chain.TxPreEvent{})
// Prepare inital block // Prepare inital block
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State()) //miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
@ -87,7 +87,7 @@ func (miner *Miner) listener() {
select { select {
case event := <-miner.events.Chan(): case event := <-miner.events.Chan():
switch event := event.(type) { switch event := event.(type) {
case ethchain.NewBlockEvent: case chain.NewBlockEvent:
miner.stopMining() miner.stopMining()
block := event.Block block := event.Block
@ -97,7 +97,7 @@ func (miner *Miner) listener() {
//logger.Infoln("New top block found resetting state") //logger.Infoln("New top block found resetting state")
// Filter out which Transactions we have that were not in this block // Filter out which Transactions we have that were not in this block
var newtxs []*ethchain.Transaction var newtxs []*chain.Transaction
for _, tx := range miner.txs { for _, tx := range miner.txs {
found := false found := false
for _, othertx := range block.Transactions() { for _, othertx := range block.Transactions() {
@ -118,7 +118,7 @@ func (miner *Miner) listener() {
} }
miner.startMining() miner.startMining()
case ethchain.TxPreEvent: case chain.TxPreEvent:
miner.stopMining() miner.stopMining()
found := false found := false
@ -171,7 +171,7 @@ func (self *Miner) mineNewBlock() {
} }
// Sort the transactions by nonce in case of odd network propagation // Sort the transactions by nonce in case of odd network propagation
sort.Sort(ethchain.TxByNonce{self.txs}) sort.Sort(chain.TxByNonce{self.txs})
// Accumulate all valid transactions and apply them to the new state // Accumulate all valid transactions and apply them to the new state
// Error may be ignored. It's not important during mining // Error may be ignored. It's not important during mining
@ -208,7 +208,7 @@ func (self *Miner) mineNewBlock() {
logger.Infoln(self.block) logger.Infoln(self.block)
// Gather the new batch of transactions currently in the tx pool // Gather the new batch of transactions currently in the tx pool
self.txs = self.ethereum.TxPool().CurrentTransactions() self.txs = self.ethereum.TxPool().CurrentTransactions()
self.ethereum.EventMux().Post(ethchain.NewBlockEvent{self.block}) self.ethereum.EventMux().Post(chain.NewBlockEvent{self.block})
} }
// Continue mining on the next block // Continue mining on the next block

@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"sync/atomic" "sync/atomic"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto" "github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
@ -15,7 +15,7 @@ type JSPipe struct {
*Pipe *Pipe
} }
func NewJSPipe(eth ethchain.EthManager) *JSPipe { func NewJSPipe(eth chain.EthManager) *JSPipe {
return &JSPipe{New(eth)} return &JSPipe{New(eth)}
} }
@ -63,7 +63,7 @@ func (self *JSPipe) PeerCount() int {
func (self *JSPipe) Peers() []JSPeer { func (self *JSPipe) Peers() []JSPeer {
var peers []JSPeer var peers []JSPeer
for peer := self.obj.Peers().Front(); peer != nil; peer = peer.Next() { for peer := self.obj.Peers().Front(); peer != nil; peer = peer.Next() {
p := peer.Value.(ethchain.Peer) p := peer.Value.(chain.Peer)
// we only want connected peers // we only want connected peers
if atomic.LoadInt32(p.Connected()) != 0 { if atomic.LoadInt32(p.Connected()) != 0 {
peers = append(peers, *NewJSPeer(p)) peers = append(peers, *NewJSPeer(p))
@ -209,7 +209,7 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
gas = ethutil.Big(gasStr) gas = ethutil.Big(gasStr)
gasPrice = ethutil.Big(gasPriceStr) gasPrice = ethutil.Big(gasPriceStr)
data []byte data []byte
tx *ethchain.Transaction tx *chain.Transaction
) )
if ethutil.IsHex(codeStr) { if ethutil.IsHex(codeStr) {
@ -219,9 +219,9 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
} }
if contractCreation { if contractCreation {
tx = ethchain.NewContractCreationTx(value, gas, gasPrice, data) tx = chain.NewContractCreationTx(value, gas, gasPrice, data)
} else { } else {
tx = ethchain.NewTransactionMessage(hash, value, gas, gasPrice, data) tx = chain.NewTransactionMessage(hash, value, gas, gasPrice, data)
} }
acc := self.obj.StateManager().TransState().GetOrNewStateObject(keyPair.Address()) acc := self.obj.StateManager().TransState().GetOrNewStateObject(keyPair.Address())
@ -240,7 +240,7 @@ func (self *JSPipe) Transact(key, toStr, valueStr, gasStr, gasPriceStr, codeStr
} }
func (self *JSPipe) PushTx(txStr string) (*JSReceipt, error) { func (self *JSPipe) PushTx(txStr string) (*JSReceipt, error) {
tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(txStr)) tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(txStr))
self.obj.TxPool().QueueTransaction(tx) self.obj.TxPool().QueueTransaction(tx)
return NewJSReciept(tx.CreatesContract(), tx.CreationAddress(self.World().State()), tx.Hash(), tx.Sender()), nil return NewJSReciept(tx.CreatesContract(), tx.CreationAddress(self.World().State()), tx.Hash(), tx.Sender()), nil
} }

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto" "github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
@ -14,7 +14,7 @@ import (
// Block interface exposed to QML // Block interface exposed to QML
type JSBlock struct { type JSBlock struct {
//Transactions string `json:"transactions"` //Transactions string `json:"transactions"`
ref *ethchain.Block ref *chain.Block
Size string `json:"size"` Size string `json:"size"`
Number int `json:"number"` Number int `json:"number"`
Hash string `json:"hash"` Hash string `json:"hash"`
@ -29,7 +29,7 @@ type JSBlock struct {
} }
// Creates a new QML Block from a chain block // Creates a new QML Block from a chain block
func NewJSBlock(block *ethchain.Block) *JSBlock { func NewJSBlock(block *chain.Block) *JSBlock {
if block == nil { if block == nil {
return &JSBlock{} return &JSBlock{}
} }
@ -75,7 +75,7 @@ func (self *JSBlock) GetTransaction(hash string) *JSTransaction {
} }
type JSTransaction struct { type JSTransaction struct {
ref *ethchain.Transaction ref *chain.Transaction
Value string `json:"value"` Value string `json:"value"`
Gas string `json:"gas"` Gas string `json:"gas"`
@ -90,7 +90,7 @@ type JSTransaction struct {
Confirmations int `json:"confirmations"` Confirmations int `json:"confirmations"`
} }
func NewJSTx(tx *ethchain.Transaction, state *ethstate.State) *JSTransaction { func NewJSTx(tx *chain.Transaction, state *ethstate.State) *JSTransaction {
hash := ethutil.Bytes2Hex(tx.Hash()) hash := ethutil.Bytes2Hex(tx.Hash())
receiver := ethutil.Bytes2Hex(tx.Recipient) receiver := ethutil.Bytes2Hex(tx.Recipient)
if receiver == "0000000000000000000000000000000000000000" { if receiver == "0000000000000000000000000000000000000000" {
@ -101,7 +101,7 @@ func NewJSTx(tx *ethchain.Transaction, state *ethstate.State) *JSTransaction {
var data string var data string
if tx.CreatesContract() { if tx.CreatesContract() {
data = strings.Join(ethchain.Disassemble(tx.Data), "\n") data = strings.Join(chain.Disassemble(tx.Data), "\n")
} else { } else {
data = ethutil.Bytes2Hex(tx.Data) data = ethutil.Bytes2Hex(tx.Data)
} }
@ -150,7 +150,7 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *
// Peer interface exposed to QML // Peer interface exposed to QML
type JSPeer struct { type JSPeer struct {
ref *ethchain.Peer ref *chain.Peer
Inbound bool `json:"isInbound"` Inbound bool `json:"isInbound"`
LastSend int64 `json:"lastSend"` LastSend int64 `json:"lastSend"`
LastPong int64 `json:"lastPong"` LastPong int64 `json:"lastPong"`
@ -162,7 +162,7 @@ type JSPeer struct {
Caps string `json:"caps"` Caps string `json:"caps"`
} }
func NewJSPeer(peer ethchain.Peer) *JSPeer { func NewJSPeer(peer chain.Peer) *JSPeer {
if peer == nil { if peer == nil {
return nil return nil
} }

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethcrypto" "github.com/ethereum/go-ethereum/ethcrypto"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
@ -19,15 +19,15 @@ type VmVars struct {
} }
type Pipe struct { type Pipe struct {
obj ethchain.EthManager obj chain.EthManager
stateManager *ethchain.StateManager stateManager *chain.StateManager
blockChain *ethchain.ChainManager blockChain *chain.ChainManager
world *World world *World
Vm VmVars Vm VmVars
} }
func New(obj ethchain.EthManager) *Pipe { func New(obj chain.EthManager) *Pipe {
pipe := &Pipe{ pipe := &Pipe{
obj: obj, obj: obj,
stateManager: obj.StateManager(), stateManager: obj.StateManager(),
@ -68,7 +68,7 @@ func (self *Pipe) ExecuteObject(object *Object, data []byte, value, gas, price *
return ret, err return ret, err
} }
func (self *Pipe) Block(hash []byte) *ethchain.Block { func (self *Pipe) Block(hash []byte) *chain.Block {
return self.blockChain.GetBlock(hash) return self.blockChain.GetBlock(hash)
} }
@ -111,7 +111,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
contractCreation = true contractCreation = true
} }
var tx *ethchain.Transaction var tx *chain.Transaction
// Compile and assemble the given data // Compile and assemble the given data
if contractCreation { if contractCreation {
script, err := ethutil.Compile(string(data), false) script, err := ethutil.Compile(string(data), false)
@ -119,7 +119,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return nil, err return nil, err
} }
tx = ethchain.NewContractCreationTx(value.BigInt(), gas.BigInt(), price.BigInt(), script) tx = chain.NewContractCreationTx(value.BigInt(), gas.BigInt(), price.BigInt(), script)
} else { } else {
data := ethutil.StringToByteFunc(string(data), func(s string) (ret []byte) { data := ethutil.StringToByteFunc(string(data), func(s string) (ret []byte) {
slice := strings.Split(s, "\n") slice := strings.Split(s, "\n")
@ -130,7 +130,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return return
}) })
tx = ethchain.NewTransactionMessage(hash, value.BigInt(), gas.BigInt(), price.BigInt(), data) tx = chain.NewTransactionMessage(hash, value.BigInt(), gas.BigInt(), price.BigInt(), data)
} }
acc := self.stateManager.TransState().GetOrNewStateObject(key.Address()) acc := self.stateManager.TransState().GetOrNewStateObject(key.Address())
@ -151,7 +151,7 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return tx.Hash(), nil return tx.Hash(), nil
} }
func (self *Pipe) PushTx(tx *ethchain.Transaction) ([]byte, error) { func (self *Pipe) PushTx(tx *chain.Transaction) ([]byte, error) {
self.obj.TxPool().QueueTransaction(tx) self.obj.TxPool().QueueTransaction(tx)
if tx.Recipient == nil { if tx.Recipient == nil {
addr := tx.CreationAddress(self.World().State()) addr := tx.CreationAddress(self.World().State())

@ -3,19 +3,19 @@ package ethpipe
import ( import (
"math/big" "math/big"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/vm" "github.com/ethereum/go-ethereum/vm"
) )
type VMEnv struct { type VMEnv struct {
state *ethstate.State state *ethstate.State
block *ethchain.Block block *chain.Block
value *big.Int value *big.Int
sender []byte sender []byte
} }
func NewEnv(state *ethstate.State, block *ethchain.Block, value *big.Int, sender []byte) *VMEnv { func NewEnv(state *ethstate.State, block *chain.Block, value *big.Int, sender []byte) *VMEnv {
return &VMEnv{ return &VMEnv{
state: state, state: state,
block: block, block: block,

@ -8,7 +8,7 @@ import (
"path/filepath" "path/filepath"
"github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
@ -62,7 +62,7 @@ func NewJSRE(ethereum *eth.Ethereum) *JSRE {
// Subscribe to events // Subscribe to events
mux := ethereum.EventMux() mux := ethereum.EventMux()
re.events = mux.Subscribe(ethchain.NewBlockEvent{}) re.events = mux.Subscribe(chain.NewBlockEvent{})
// We have to make sure that, whoever calls this, calls "Stop" // We have to make sure that, whoever calls this, calls "Stop"
go re.mainLoop() go re.mainLoop()
@ -130,7 +130,7 @@ func (self *JSRE) dump(call otto.FunctionCall) otto.Value {
var state *ethstate.State var state *ethstate.State
if len(call.ArgumentList) > 0 { if len(call.ArgumentList) > 0 {
var block *ethchain.Block var block *chain.Block
if call.Argument(0).IsNumber() { if call.Argument(0).IsNumber() {
num, _ := call.Argument(0).ToInteger() num, _ := call.Argument(0).ToInteger()
block = self.ethereum.ChainManager().GetBlockByNumber(uint64(num)) block = self.ethereum.ChainManager().GetBlockByNumber(uint64(num))

12
peer.go

@ -12,7 +12,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethlog"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethwire" "github.com/ethereum/go-ethereum/ethwire"
@ -155,7 +155,7 @@ type Peer struct {
pingTime time.Duration pingTime time.Duration
pingStartTime time.Time pingStartTime time.Time
lastRequestedBlock *ethchain.Block lastRequestedBlock *chain.Block
protocolCaps *ethutil.Value protocolCaps *ethutil.Value
} }
@ -378,7 +378,7 @@ func formatMessage(msg *ethwire.Msg) (ret string) {
case ethwire.MsgPeersTy: case ethwire.MsgPeersTy:
ret += fmt.Sprintf("(%d entries)", msg.Data.Len()) ret += fmt.Sprintf("(%d entries)", msg.Data.Len())
case ethwire.MsgBlockTy: case ethwire.MsgBlockTy:
b1, b2 := ethchain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1)) b1, b2 := chain.NewBlockFromRlpValue(msg.Data.Get(0)), ethchain.NewBlockFromRlpValue(msg.Data.Get(msg.Data.Len()-1))
ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4]) ret += fmt.Sprintf("(%d entries) %x - %x", msg.Data.Len(), b1.Hash()[0:4], b2.Hash()[0:4])
case ethwire.MsgBlockHashesTy: case ethwire.MsgBlockHashesTy:
h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes() h1, h2 := msg.Data.Get(0).Bytes(), msg.Data.Get(msg.Data.Len()-1).Bytes()
@ -429,7 +429,7 @@ func (p *Peer) HandleInbound() {
// in the TxPool where it will undergo validation and // in the TxPool where it will undergo validation and
// processing when a new block is found // processing when a new block is found
for i := 0; i < msg.Data.Len(); i++ { for i := 0; i < msg.Data.Len(); i++ {
tx := ethchain.NewTransactionFromValue(msg.Data.Get(i)) tx := chain.NewTransactionFromValue(msg.Data.Get(i))
p.ethereum.TxPool().QueueTransaction(tx) p.ethereum.TxPool().QueueTransaction(tx)
} }
case ethwire.MsgGetPeersTy: case ethwire.MsgGetPeersTy:
@ -535,7 +535,7 @@ func (p *Peer) HandleInbound() {
it := msg.Data.NewIterator() it := msg.Data.NewIterator()
for it.Next() { for it.Next() {
block := ethchain.NewBlockFromRlpValue(it.Value()) block := chain.NewBlockFromRlpValue(it.Value())
blockPool.Add(block, p) blockPool.Add(block, p)
p.lastBlockReceived = time.Now() p.lastBlockReceived = time.Now()
@ -543,7 +543,7 @@ func (p *Peer) HandleInbound() {
case ethwire.MsgNewBlockTy: case ethwire.MsgNewBlockTy:
var ( var (
blockPool = p.ethereum.blockPool blockPool = p.ethereum.blockPool
block = ethchain.NewBlockFromRlpValue(msg.Data.Get(0)) block = chain.NewBlockFromRlpValue(msg.Data.Get(0))
td = msg.Data.Get(1).BigInt() td = msg.Data.Get(1).BigInt()
) )

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

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

@ -3,20 +3,20 @@ package utils
import ( import (
"math/big" "math/big"
"github.com/ethereum/go-ethereum/ethchain" "github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethstate" "github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/vm" "github.com/ethereum/go-ethereum/vm"
) )
type VMEnv struct { type VMEnv struct {
state *ethstate.State state *ethstate.State
block *ethchain.Block block *chain.Block
transactor []byte transactor []byte
value *big.Int value *big.Int
} }
func NewEnv(state *ethstate.State, block *ethchain.Block, transactor []byte, value *big.Int) *VMEnv { func NewEnv(state *ethstate.State, block *chain.Block, transactor []byte, value *big.Int) *VMEnv {
return &VMEnv{ return &VMEnv{
state: state, state: state,
block: block, block: block,