From 4718375db127911e4f0d13faf865f01b827cd96f Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 21 Jan 2020 15:37:47 +0300 Subject: [PATCH] rpc: return amount of consumed GAS in invoke* --- pkg/core/blockchain.go | 1 + pkg/rpc/server.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index e95583ba0..f40c3e114 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1382,6 +1382,7 @@ func (bc *Blockchain) GetTestVM() (*vm.VM, storage.Store) { tmpStore := storage.NewMemCachedStore(bc.dao.store) systemInterop := bc.newInteropContext(trigger.Application, tmpStore, nil, nil) vm := bc.spawnVMWithInterops(systemInterop) + vm.SetPriceGetter(getPrice) return vm, tmpStore } diff --git a/pkg/rpc/server.go b/pkg/rpc/server.go index 3bc5cd451..9c0e3b86f 100644 --- a/pkg/rpc/server.go +++ b/pkg/rpc/server.go @@ -400,7 +400,7 @@ func (s *Server) runScriptInVM(script []byte) *wrappers.InvokeResult { _ = vm.Run() result := &wrappers.InvokeResult{ State: vm.State(), - GasConsumed: "0.1", + GasConsumed: vm.GasConsumed().String(), Script: hex.EncodeToString(script), Stack: vm.Estack(), }