diff --git a/pkg/compiler/syscall.go b/pkg/compiler/syscall.go index b4ae7cd96..efd9c6daf 100644 --- a/pkg/compiler/syscall.go +++ b/pkg/compiler/syscall.go @@ -41,7 +41,7 @@ var syscalls = map[string]map[string]string{ "GetHeader": "Neo.Blockchain.GetHeader", "GetHeight": "Neo.Blockchain.GetHeight", "GetTransaction": "System.Blockchain.GetTransaction", - "GetTransactionHeight": "Neo.Blockchain.GetTransactionHeight", + "GetTransactionHeight": "System.Blockchain.GetTransactionHeight", "GetValidators": "Neo.Blockchain.GetValidators", }, "header": { diff --git a/pkg/core/interop_system.go b/pkg/core/interop_system.go index 7254177f4..8edb9fa4a 100644 --- a/pkg/core/interop_system.go +++ b/pkg/core/interop_system.go @@ -151,8 +151,9 @@ func bcGetTransaction(ic *interop.Context, v *vm.VM) error { // bcGetTransactionHeight returns transaction height. func bcGetTransactionHeight(ic *interop.Context, v *vm.VM) error { _, h, err := getTransactionAndHeight(ic.DAO, v) - if err != nil { - return err + if err != nil || !isTraceableBlock(ic, h) { + v.Estack().PushVal(-1) + return nil } v.Estack().PushVal(h) return nil diff --git a/pkg/core/interops.go b/pkg/core/interops.go index 091316dfe..14d6b8fee 100644 --- a/pkg/core/interops.go +++ b/pkg/core/interops.go @@ -112,7 +112,6 @@ var neoInterops = []interop.Function{ {Name: "Neo.Blockchain.GetContract", Func: bcGetContract, Price: 100}, {Name: "Neo.Blockchain.GetHeader", Func: bcGetHeader, Price: 100}, {Name: "Neo.Blockchain.GetHeight", Func: bcGetHeight, Price: 1}, - {Name: "Neo.Blockchain.GetTransactionHeight", Func: bcGetTransactionHeight, Price: 100}, {Name: "Neo.Contract.Create", Func: contractCreate, Price: 0}, {Name: "Neo.Contract.Destroy", Func: contractDestroy, Price: 1}, {Name: "Neo.Contract.GetScript", Func: contractGetScript, Price: 1}, diff --git a/pkg/interop/blockchain/blockchain.go b/pkg/interop/blockchain/blockchain.go index a18ff2ff6..fbe2bbe2d 100644 --- a/pkg/interop/blockchain/blockchain.go +++ b/pkg/interop/blockchain/blockchain.go @@ -67,7 +67,7 @@ func GetTransaction(hash []byte) Transaction { // GetTransactionHeight returns transaction's height (index of the block that // includes it) by the given ID (256 bit in BE format represented as a slice of -// 32 bytes). This function uses `Neo.Blockchain.GetTransactionHeight` syscall. +// 32 bytes). This function uses `System.Blockchain.GetTransactionHeight` syscall. func GetTransactionHeight(hash []byte) int { return 0 }