Cleanup old code

This commit is contained in:
obscuren 2015-01-03 17:29:08 +01:00
parent ca1b2a1a91
commit bd0c267cbe
3 changed files with 7 additions and 14 deletions

View File

@ -5,7 +5,6 @@ import (
"math/big" "math/big"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/state"
) )
type ContextRef interface { type ContextRef interface {
@ -18,7 +17,6 @@ type Context struct {
caller ContextRef caller ContextRef
object ContextRef object ContextRef
Code []byte Code []byte
message *state.Message
Gas, UsedGas, Price *big.Int Gas, UsedGas, Price *big.Int
@ -26,8 +24,8 @@ type Context struct {
} }
// Create a new context for the given data items // Create a new context for the given data items
func NewContext(msg *state.Message, caller ContextRef, object ContextRef, code []byte, gas, price *big.Int) *Context { func NewContext(caller ContextRef, object ContextRef, code []byte, gas, price *big.Int) *Context {
c := &Context{message: msg, caller: caller, object: object, Code: code, Args: nil} c := &Context{caller: caller, object: object, Code: code, Args: nil}
// Gas should be a pointer so it can safely be reduced through the run // Gas should be a pointer so it can safely be reduced through the run
// This pointer will be off the state transition // This pointer will be off the state transition

View File

@ -30,11 +30,6 @@ type Environment interface {
Create(me ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef) Create(me ContextRef, addr, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef)
} }
type Object interface {
GetStorage(key *big.Int) *ethutil.Value
SetStorage(key *big.Int, value *ethutil.Value)
}
type Account interface { type Account interface {
SubBalance(amount *big.Int) SubBalance(amount *big.Int)
AddBalance(amount *big.Int) AddBalance(amount *big.Int)

View File

@ -47,7 +47,7 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
Timestamp: self.env.Time(), Coinbase: self.env.Coinbase(), Number: self.env.BlockNumber(), Timestamp: self.env.Time(), Coinbase: self.env.Coinbase(), Number: self.env.BlockNumber(),
Value: value, Value: value,
}) })
context := NewContext(msg, caller, me, code, gas, price) context := NewContext(caller, me, code, gas, price)
if self.Recoverable { if self.Recoverable {
// Recover from any require exception // Recover from any require exception
@ -617,7 +617,7 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price *
val, loc := stack.Popn() val, loc := stack.Popn()
statedb.SetState(context.Address(), loc.Bytes(), val) statedb.SetState(context.Address(), loc.Bytes(), val)
context.message.AddStorageChange(loc.Bytes()) msg.AddStorageChange(loc.Bytes())
self.Printf(" {0x%x : 0x%x}", loc.Bytes(), val.Bytes()) self.Printf(" {0x%x : 0x%x}", loc.Bytes(), val.Bytes())
case JUMP: case JUMP: