From 5d941364bdd3694074093842c76c458083ec61a8 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sun, 17 May 2020 23:35:56 +0300 Subject: [PATCH] compiler/interop: expose GetTransactionHeight And sort syscall names as they change the indentation anyway. --- pkg/compiler/syscall.go | 17 +++++++++-------- pkg/interop/blockchain/blockchain.go | 7 +++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pkg/compiler/syscall.go b/pkg/compiler/syscall.go index 66336a141..77367a514 100644 --- a/pkg/compiler/syscall.go +++ b/pkg/compiler/syscall.go @@ -28,14 +28,15 @@ var syscalls = map[string]map[string]string{ "Deserialize": "Neo.Runtime.Deserialize", }, "blockchain": { - "GetHeight": "Neo.Blockchain.GetHeight", - "GetHeader": "Neo.Blockchain.GetHeader", - "GetBlock": "Neo.Blockchain.GetBlock", - "GetTransaction": "Neo.Blockchain.GetTransaction", - "GetContract": "Neo.Blockchain.GetContract", - "GetAccount": "Neo.Blockchain.GetAccount", - "GetValidators": "Neo.Blockchain.GetValidators", - "GetAsset": "Neo.Blockchain.GetAsset", + "GetAccount": "Neo.Blockchain.GetAccount", + "GetAsset": "Neo.Blockchain.GetAsset", + "GetBlock": "Neo.Blockchain.GetBlock", + "GetContract": "Neo.Blockchain.GetContract", + "GetHeader": "Neo.Blockchain.GetHeader", + "GetHeight": "Neo.Blockchain.GetHeight", + "GetTransaction": "Neo.Blockchain.GetTransaction", + "GetTransactionHeight": "Neo.Blockchain.GetTransactionHeight", + "GetValidators": "Neo.Blockchain.GetValidators", }, "header": { "GetIndex": "Neo.Header.GetIndex", diff --git a/pkg/interop/blockchain/blockchain.go b/pkg/interop/blockchain/blockchain.go index 120b8cec6..c38e4dd7d 100644 --- a/pkg/interop/blockchain/blockchain.go +++ b/pkg/interop/blockchain/blockchain.go @@ -44,6 +44,13 @@ func GetTransaction(hash []byte) transaction.Transaction { return transaction.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. +func GetTransactionHeight(hash []byte) int { + return 0 +} + // GetContract returns contract found by the given script hash (160 bit in BE // format represented as a slice of 20 bytes). Refer to the `contract` package // for details on how to use the returned structure. This function uses