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 committed Nov 25, 2021
1 parent 4ebeca1 commit 519cf98
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions core/vm/contract.go
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 519cf98

Please sign in to comment.