emit: remove tailCall argument from AppCall

There is no TAILCALL opcode in NEO3.
This commit is contained in:
Evgenii Stratonikov 2020-05-07 14:58:59 +03:00
parent 73c82584a3
commit c0147c76ac
3 changed files with 8 additions and 9 deletions

View file

@ -1616,7 +1616,7 @@ func ScriptFromWitness(hash util.Uint160, witness *transaction.Witness) ([]byte,
if len(verification) == 0 { if len(verification) == 0 {
bb := io.NewBufBinWriter() bb := io.NewBufBinWriter()
emit.AppCall(bb.BinWriter, hash, false) emit.AppCall(bb.BinWriter, hash)
verification = bb.Bytes() verification = bb.Bytes()
} else if h := witness.ScriptHash(); hash != h { } else if h := witness.ScriptHash(); hash != h {
return nil, errors.New("witness hash mismatch") return nil, errors.New("witness hash mismatch")

View file

@ -210,7 +210,7 @@ func CreateFunctionInvocationScript(contract util.Uint160, params Params) ([]byt
} }
} }
emit.AppCall(script.BinWriter, contract, false) emit.AppCall(script.BinWriter, contract)
return script.Bytes(), nil return script.Bytes(), nil
} }
@ -224,6 +224,6 @@ func CreateInvocationScript(contract util.Uint160, funcParams []Param) ([]byte,
if err != nil { if err != nil {
return nil, err return nil, err
} }
emit.AppCall(script.BinWriter, contract, false) emit.AppCall(script.BinWriter, contract)
return script.Bytes(), nil return script.Bytes(), nil
} }

View file

@ -141,9 +141,8 @@ func Jmp(w *io.BinWriter, op opcode.Opcode, label uint16) {
Instruction(w, op, buf) Instruction(w, op, buf)
} }
// AppCall emits an appcall, if tailCall is true, tailCall opcode will be // AppCall emits call to provided contract.
// emitted instead. func AppCall(w *io.BinWriter, scriptHash util.Uint160) {
func AppCall(w *io.BinWriter, scriptHash util.Uint160, tailCall bool) {
Bytes(w, scriptHash.BytesBE()) Bytes(w, scriptHash.BytesBE())
Syscall(w, "System.Contract.Call") Syscall(w, "System.Contract.Call")
} }
@ -152,21 +151,21 @@ func AppCall(w *io.BinWriter, scriptHash util.Uint160, tailCall bool) {
func AppCallWithOperationAndArgs(w *io.BinWriter, scriptHash util.Uint160, operation string, args ...interface{}) { func AppCallWithOperationAndArgs(w *io.BinWriter, scriptHash util.Uint160, operation string, args ...interface{}) {
Array(w, args...) Array(w, args...)
String(w, operation) String(w, operation)
AppCall(w, scriptHash, false) AppCall(w, scriptHash)
} }
// AppCallWithOperationAndData emits an appcall with the given operation and data. // AppCallWithOperationAndData emits an appcall with the given operation and data.
func AppCallWithOperationAndData(w *io.BinWriter, scriptHash util.Uint160, operation string, data []byte) { func AppCallWithOperationAndData(w *io.BinWriter, scriptHash util.Uint160, operation string, data []byte) {
Bytes(w, data) Bytes(w, data)
String(w, operation) String(w, operation)
AppCall(w, scriptHash, false) AppCall(w, scriptHash)
} }
// AppCallWithOperation emits an appcall with the given operation. // AppCallWithOperation emits an appcall with the given operation.
func AppCallWithOperation(w *io.BinWriter, scriptHash util.Uint160, operation string) { func AppCallWithOperation(w *io.BinWriter, scriptHash util.Uint160, operation string) {
Bool(w, false) Bool(w, false)
String(w, operation) String(w, operation)
AppCall(w, scriptHash, false) AppCall(w, scriptHash)
} }
func isInstructionJmp(op opcode.Opcode) bool { func isInstructionJmp(op opcode.Opcode) bool {