Add tests for uncle timestamps and refactor timestamp type
This commit is contained in:
@ -33,7 +33,7 @@ type Environment interface {
|
||||
BlockNumber() *big.Int
|
||||
GetHash(n uint64) common.Hash
|
||||
Coinbase() common.Address
|
||||
Time() uint64
|
||||
Time() *big.Int
|
||||
Difficulty() *big.Int
|
||||
GasLimit() *big.Int
|
||||
CanTransfer(from Account, balance *big.Int) bool
|
||||
|
@ -341,7 +341,7 @@ func opCoinbase(instr instruction, env Environment, context *Context, memory *Me
|
||||
}
|
||||
|
||||
func opTimestamp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {
|
||||
stack.push(U256(new(big.Int).SetUint64(env.Time())))
|
||||
stack.push(U256(new(big.Int).Set(env.Time())))
|
||||
}
|
||||
|
||||
func opNumber(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {
|
||||
|
@ -93,7 +93,7 @@ func (self *Env) StructLogs() []StructLog {
|
||||
|
||||
//func (self *Env) PrevHash() []byte { return self.parent }
|
||||
func (self *Env) Coinbase() common.Address { return common.Address{} }
|
||||
func (self *Env) Time() uint64 { return uint64(time.Now().Unix()) }
|
||||
func (self *Env) Time() *big.Int { return big.NewInt(time.Now().Unix()) }
|
||||
func (self *Env) Difficulty() *big.Int { return big.NewInt(0) }
|
||||
func (self *Env) State() *state.StateDB { return nil }
|
||||
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
|
||||
|
@ -491,7 +491,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) {
|
||||
case TIMESTAMP:
|
||||
time := self.env.Time()
|
||||
|
||||
stack.push(new(big.Int).SetUint64(time))
|
||||
stack.push(new(big.Int).Set(time))
|
||||
|
||||
case NUMBER:
|
||||
number := self.env.BlockNumber()
|
||||
|
Reference in New Issue
Block a user