Begin of moving objects to types package

* Block(s)
* Transaction(s)
This commit is contained in:
obscuren
2014-11-18 16:58:22 +01:00
parent 62cd9946ee
commit a1b6a9ac29
33 changed files with 189 additions and 151 deletions

View File

@ -21,8 +21,7 @@ import (
"encoding/json"
"os"
"strconv"
"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/ethutil"
"github.com/ethereum/go-ethereum/logger"
@ -106,7 +105,7 @@ func (self *Gui) DumpState(hash, path string) {
if len(hash) == 0 {
stateDump = self.eth.BlockManager().CurrentState().Dump()
} else {
var block *chain.Block
var block *types.Block
if hash[0] == '#' {
i, _ := strconv.Atoi(hash[1:])
block = self.eth.ChainManager().GetBlockByNumber(uint64(i))

View File

@ -21,6 +21,7 @@ import (
"encoding/json"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"
@ -36,7 +37,7 @@ type AppContainer interface {
Window() *qml.Window
Engine() *qml.Engine
NewBlock(*chain.Block)
NewBlock(*types.Block)
NewWatcher(chan bool)
Messages(state.Messages, string)
Post(string, int)

View File

@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
@ -290,7 +291,7 @@ func (self *Gui) loadMergedMiningOptions() {
}
}
func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) {
func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
pipe := xeth.New(gui.eth)
nameReg := pipe.World().Config().Get("NameReg")
addr := gui.address()
@ -340,7 +341,7 @@ func (gui *Gui) insertTransaction(window string, tx *chain.Transaction) {
func (gui *Gui) readPreviousTransactions() {
it := gui.txDb.NewIterator()
for it.Next() {
tx := chain.NewTransactionFromBytes(it.Value())
tx := types.NewTransactionFromBytes(it.Value())
gui.insertTransaction("post", tx)
@ -348,7 +349,7 @@ func (gui *Gui) readPreviousTransactions() {
it.Release()
}
func (gui *Gui) processBlock(block *chain.Block, initial bool) {
func (gui *Gui) processBlock(block *types.Block, initial bool) {
name := strings.Trim(gui.pipe.World().Config().Get("NameReg").Storage(block.Coinbase).Str(), "\x00")
b := xeth.NewJSBlock(block)
b.Name = name

View File

@ -26,8 +26,7 @@ import (
"os"
"path"
"path/filepath"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/javascript"
"github.com/ethereum/go-ethereum/state"
@ -138,7 +137,7 @@ func (app *HtmlApplication) Window() *qml.Window {
return app.win
}
func (app *HtmlApplication) NewBlock(block *chain.Block) {
func (app *HtmlApplication) NewBlock(block *types.Block) {
b := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())}
app.webView.Call("onNewBlockCb", b)
}

View File

@ -20,8 +20,7 @@ package main
import (
"fmt"
"runtime"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
@ -65,7 +64,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
}
// Events
func (app *QmlApplication) NewBlock(block *chain.Block) {
func (app *QmlApplication) NewBlock(block *types.Block) {
pblock := &xeth.JSBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Bytes2Hex(block.Hash())}
app.win.Call("onNewBlockCb", pblock)
}

View File

@ -26,6 +26,7 @@ import (
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/chain"
"github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/javascript"
@ -126,7 +127,7 @@ func (self *UiLib) PastPeers() *ethutil.List {
}
func (self *UiLib) ImportTx(rlpTx string) {
tx := chain.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
tx := types.NewTransactionFromBytes(ethutil.Hex2Bytes(rlpTx))
self.eth.TxPool().QueueTransaction(tx)
}
@ -228,7 +229,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.BlockCallback = func(block *chain.Block) {
filter.BlockCallback = func(block *types.Block) {
if self.win != nil && self.win.Root() != nil {
self.win.Root().Call("invokeFilterCallback", "{}", id)
} else {