Refactored ethutil.Config.Db out
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user