vm: process OLDPUSH1 at the context level

The only usecase for this opcode is single-byte verification scripts.
This commit is contained in:
Evgenii Stratonikov 2020-05-06 12:58:58 +03:00
parent ec6ade4c9b
commit 115919aaf7
2 changed files with 6 additions and 4 deletions

View file

@ -74,6 +74,12 @@ func (c *Context) Next() (opcode.Opcode, []byte, error) {
var numtoread int var numtoread int
switch instr { switch instr {
case opcode.OLDPUSH1:
// OLDPUSH1 is used during transition to NEO3 in verification scripts.
// FIXME remove #927
if len(c.prog) == 1 {
return opcode.PUSH1, nil, nil
}
case opcode.PUSHDATA1: case opcode.PUSHDATA1:
if c.nextip >= len(c.prog) { if c.nextip >= len(c.prog) {
err = errNoInstParam err = errNoInstParam

View file

@ -553,10 +553,6 @@ func (v *VM) execute(ctx *Context, op opcode.Opcode, parameter []byte) (err erro
val := int(op) - int(opcode.PUSH1) + 1 val := int(op) - int(opcode.PUSH1) + 1
v.estack.PushVal(val) v.estack.PushVal(val)
case opcode.OLDPUSH1:
// FIXME remove this after Issue transactions will be removed
v.estack.PushVal(1)
case opcode.PUSH0: case opcode.PUSH0:
v.estack.PushVal([]byte{}) v.estack.PushVal([]byte{})