core/vm: simplify op lookup in contract (#23974)

pull/23977/head
Andrei Maiboroda 3 years ago committed by GitHub
parent 4ebeca19d7
commit 519cf98b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      core/vm/contract.go

@ -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.

Loading…
Cancel
Save