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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ import (
"path"
"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/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
@ -138,7 +138,7 @@ func (app *HtmlApplication) Window() *qml.Window {
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())}
app.webView.Call("onNewBlockCb", b)
}

View File

@ -21,7 +21,7 @@ import (
"fmt"
"runtime"
"github.com/ethereum/go-ethereum/ethchain"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
"github.com/ethereum/go-ethereum/ethutil"
@ -65,7 +65,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
}
// 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())}
app.win.Call("onNewBlockCb", pblock)
}

View File

@ -25,7 +25,7 @@ import (
"strings"
"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/ethpipe"
"github.com/ethereum/go-ethereum/ethstate"
@ -120,7 +120,7 @@ func (self *UiLib) PastPeers() *ethutil.List {
}
func (self *UiLib) ImportTx(rlpTx string) {
tx := ethchain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
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) {
filter := ethchain.NewFilter(self.eth)
filter.BlockCallback = func(block *ethchain.Block) {
filter := chain.NewFilter(self.eth)
filter.BlockCallback = func(block *chain.Block) {
self.win.Root().Call("invokeFilterCallback", "{}", id)
}
id = self.eth.InstallFilter(filter)