From 519cf98b69030535be3033dc412572c6085810ad Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Thu, 25 Nov 2021 20:10:01 +0100 Subject: [PATCH] core/vm: simplify op lookup in contract (#23974) --- core/vm/contract.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/core/vm/contract.go b/core/vm/contract.go index 61dbd5007adb..bb0902969ec7 100644 --- a/core/vm/contract.go +++ b/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.