From 514f862b81e0b30aca20050869660f469e957d95 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 18 May 2020 18:22:07 +0300 Subject: [PATCH] compiler|transaction: fix transaction.GetScript build, add to interop There is no such syscall as Neo.Transaction.GetScript and GetScript should be available for contract's use. --- pkg/compiler/syscall.go | 2 +- pkg/interop/transaction/transaction.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/compiler/syscall.go b/pkg/compiler/syscall.go index a470f34fb..2459a49e6 100644 --- a/pkg/compiler/syscall.go +++ b/pkg/compiler/syscall.go @@ -69,7 +69,7 @@ var syscalls = map[string]map[string]string{ "GetOutputs": "Neo.Transaction.GetOutputs", "GetReferences": "Neo.Transaction.GetReferences", "GetUnspentCoins": "Neo.Transaction.GetUnspentCoins", - "GetScript": "Neo.Transaction.GetScript", + "GetScript": "Neo.InvocationTransaction.GetScript", }, "asset": { "Create": "Neo.Asset.Create", diff --git a/pkg/interop/transaction/transaction.go b/pkg/interop/transaction/transaction.go index 1d863f5c3..354fcf019 100644 --- a/pkg/interop/transaction/transaction.go +++ b/pkg/interop/transaction/transaction.go @@ -48,3 +48,10 @@ func GetInputs(t Transaction) []input.Input { func GetOutputs(t Transaction) []output.Output { return []output.Output{} } + +// GetScript returns the script stored in a given Invocation transaction. +// Calling it for any other Transaction type would lead to failure. It uses +// `Neo.InvocationTransaction.GetScript` syscall. +func GetScript(t Transaction) []byte { + return nil +}