aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-07 20:17:48 +0800
committerobscuren <geffobscura@gmail.com>2015-01-07 20:17:48 +0800
commitfed3e6a808921fb8274b50043c5c39a24a1bbccf (patch)
treed632e95cfce78bd9a99a52bf7f30ee3ff980dfd3 /cmd
parent032ab665299d75bffc25260e8fa477ace19db06a (diff)
downloaddexon-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.gz
dexon-fed3e6a808921fb8274b50043c5c39a24a1bbccf.tar.zst
dexon-fed3e6a808921fb8274b50043c5c39a24a1bbccf.zip
Refactored ethutil.Config.Db out
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethereum/main.go4
-rw-r--r--cmd/ethtest/main.go10
-rw-r--r--cmd/evm/main.go3
-rw-r--r--cmd/mist/bindings.go3
-rw-r--r--cmd/mist/gui.go19
-rw-r--r--cmd/utils/cmd.go4
6 files changed, 18 insertions, 25 deletions
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 3243cc7fb..b816c678e 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/state"
)
const (
@@ -103,7 +104,8 @@ func main() {
}
// Leave the Println. This needs clean output for piping
- fmt.Printf("%s\n", block.State().Dump())
+ statedb := state.New(block.Root(), ethereum.Db())
+ fmt.Printf("%s\n", statedb.Dump())
fmt.Println(block)
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go
index 05e99564c..7d1c3de01 100644
--- a/cmd/ethtest/main.go
+++ b/cmd/ethtest/main.go
@@ -29,6 +29,7 @@ import (
"os"
"strings"
+ "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/tests/helper"
@@ -41,8 +42,8 @@ type Account struct {
Storage map[string]string
}
-func StateObjectFromAccount(addr string, account Account) *state.StateObject {
- obj := state.NewStateObject(ethutil.Hex2Bytes(addr))
+func StateObjectFromAccount(db ethutil.Database, addr string, account Account) *state.StateObject {
+ obj := state.NewStateObject(ethutil.Hex2Bytes(addr), db)
obj.SetBalance(ethutil.Big(account.Balance))
if ethutil.IsHex(account.Code) {
@@ -74,9 +75,10 @@ func RunVmTest(js string) (failed int) {
}
for name, test := range tests {
- state := state.New(helper.NewTrie())
+ db, _ := ethdb.NewMemDatabase()
+ state := state.New(nil, db)
for addr, account := range test.Pre {
- obj := StateObjectFromAccount(addr, account)
+ obj := StateObjectFromAccount(db, addr, account)
state.SetStateObject(obj)
}
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index f902c99e5..f819386fe 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -35,7 +35,6 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/ptrie"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/vm"
)
@@ -63,7 +62,7 @@ func main() {
ethutil.ReadConfig("/tmp/evmtest", "/tmp/evm", "")
db, _ := ethdb.NewMemDatabase()
- statedb := state.New(ptrie.New(nil, db))
+ statedb := state.New(nil, db)
sender := statedb.NewStateObject([]byte("sender"))
receiver := statedb.NewStateObject([]byte("receiver"))
//receiver.SetCode([]byte(*code))
diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go
index e91a157dc..f6d1c40da 100644
--- a/cmd/mist/bindings.go
+++ b/cmd/mist/bindings.go
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/state"
)
type plugin struct {
@@ -121,7 +122,7 @@ func (self *Gui) DumpState(hash, path string) {
return
}
- stateDump = block.State().Dump()
+ stateDump = state.New(block.Root(), self.eth.Db()).Dump()
}
file, err := os.OpenFile(path[7:], os.O_CREATE|os.O_RDWR, os.ModePerm)
diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go
index 26239c4db..2e3f329b2 100644
--- a/cmd/mist/gui.go
+++ b/cmd/mist/gui.go
@@ -117,18 +117,7 @@ func (gui *Gui) Start(assetPath string) {
context.SetVar("eth", gui.uiLib)
context.SetVar("shh", gui.whisper)
- // Load the main QML interface
- data, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
-
- var win *qml.Window
- var err error
- var addlog = false
- if len(data) == 0 {
- win, err = gui.showKeyImport(context)
- } else {
- win, err = gui.showWallet(context)
- addlog = true
- }
+ win, err := gui.showWallet(context)
if err != nil {
guilogger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err)
@@ -139,9 +128,7 @@ func (gui *Gui) Start(assetPath string) {
win.Show()
// only add the gui guilogger after window is shown otherwise slider wont be shown
- if addlog {
- logger.AddLogSystem(gui)
- }
+ logger.AddLogSystem(gui)
win.Wait()
// need to silence gui guilogger after window closed otherwise logsystem hangs (but do not save loglevel)
@@ -275,7 +262,7 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
}
var (
- ptx = xeth.NewJSTx(tx, gui.xeth.World().State())
+ ptx = xeth.NewJSTx(tx)
send = nameReg.Storage(tx.From())
rec = nameReg.Storage(tx.To())
s, r string
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 1a85668b0..a57d3266f 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
+ "github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
)
@@ -259,7 +260,8 @@ func BlockDo(ethereum *eth.Ethereum, hash []byte) error {
parent := ethereum.ChainManager().GetBlock(block.ParentHash())
- _, err := ethereum.BlockProcessor().TransitionState(parent.State(), parent, block)
+ statedb := state.New(parent.Root(), ethereum.Db())
+ _, err := ethereum.BlockProcessor().TransitionState(statedb, parent, block)
if err != nil {
return err
}