Refactored ethutil.Config.Db out
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"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"
|
||||
"github.com/ethereum/go-ethereum/state"
|
||||
@ -38,8 +39,8 @@ func (self Log) Topics() [][]byte {
|
||||
return t
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -84,9 +85,10 @@ func RunVmTest(p string, t *testing.T) {
|
||||
continue
|
||||
}
|
||||
*/
|
||||
statedb := state.New(helper.NewTrie())
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
statedb := state.New(nil, db)
|
||||
for addr, account := range test.Pre {
|
||||
obj := StateObjectFromAccount(addr, account)
|
||||
obj := StateObjectFromAccount(db, addr, account)
|
||||
statedb.SetStateObject(obj)
|
||||
for a, v := range account.Storage {
|
||||
obj.SetState(helper.FromHex(a), ethutil.NewValue(helper.FromHex(v)))
|
||||
|
Reference in New Issue
Block a user