@@ -29,7 +29,6 @@ import (
2929 "github.com/ethereum/go-ethereum/core/state"
3030 "github.com/ethereum/go-ethereum/core/vm"
3131 "github.com/ethereum/go-ethereum/core/vm/runtime"
32- "github.com/ethereum/go-ethereum/crypto"
3332 "github.com/ethereum/go-ethereum/ethdb"
3433 "github.com/ethereum/go-ethereum/logger/glog"
3534 "gopkg.in/urfave/cli.v1"
@@ -115,9 +114,13 @@ func run(ctx *cli.Context) error {
115114 glog .SetToStderr (true )
116115 glog .SetV (ctx .GlobalInt (VerbosityFlag .Name ))
117116
118- db , _ := ethdb .NewMemDatabase ()
119- statedb , _ := state .New (common.Hash {}, db )
120- sender := statedb .CreateAccount (common .StringToAddress ("sender" ))
117+ var (
118+ db , _ = ethdb .NewMemDatabase ()
119+ statedb , _ = state .New (common.Hash {}, db )
120+ address = common .StringToAddress ("sender" )
121+ sender = vm .AccountRef (address )
122+ )
123+ statedb .CreateAccount (common .StringToAddress ("sender" ))
121124
122125 logger := vm .NewStructLogger (nil )
123126
@@ -166,10 +169,11 @@ func run(ctx *cli.Context) error {
166169 },
167170 })
168171 } else {
169- receiver := statedb .CreateAccount (common .StringToAddress ("receiver" ))
170- receiver .SetCode (crypto .Keccak256Hash (code ), code )
172+ receiverAddress := common .StringToAddress ("receiver" )
173+ statedb .CreateAccount (receiverAddress )
174+ statedb .SetCode (receiverAddress , code )
171175
172- ret , err = runtime .Call (receiver . Address () , common .Hex2Bytes (ctx .GlobalString (InputFlag .Name )), & runtime.Config {
176+ ret , err = runtime .Call (receiverAddress , common .Hex2Bytes (ctx .GlobalString (InputFlag .Name )), & runtime.Config {
173177 Origin : sender .Address (),
174178 State : statedb ,
175179 GasLimit : common .Big (ctx .GlobalString (GasFlag .Name )).Uint64 (),
0 commit comments