Skip to content

Commit

Permalink
core/vm: simplify op lookup in contract (ethereum#23974)
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 authored and JacekGlen committed May 26, 2022
1 parent 8c2db1e commit 781d128
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions core/vm/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,11 @@ func (c *Contract) AsDelegate() *Contract {

// GetOp returns the n'th element in the contract's byte array
func (c *Contract) GetOp(n uint64) OpCode {
return OpCode(c.GetByte(n))
}

// GetByte returns the n'th byte in the contract's byte array
func (c *Contract) GetByte(n uint64) byte {
if n < uint64(len(c.Code)) {
return c.Code[n]
return OpCode(c.Code[n])
}

return 0
return STOP
}

// Caller returns the caller of the contract.
Expand Down

0 comments on commit 781d128

Please sign in to comment.