remove scriptHash type

This commit is contained in:
Slava0135 2024-06-07 10:46:00 +03:00
parent dd9a0c56f1
commit 14f867564d
2 changed files with 4 additions and 6 deletions

View file

@ -89,7 +89,7 @@ func CompileFile(t testing.TB, sender util.Uint160, srcPath string, configPath s
return c return c
} }
func collectCoverage(t testing.TB, di *compiler.DebugInfo, h scriptHash) { func collectCoverage(t testing.TB, di *compiler.DebugInfo, h util.Uint160) {
if isCoverageEnabled() { if isCoverageEnabled() {
if _, ok := rawCoverage[h]; !ok { if _, ok := rawCoverage[h]; !ok {
rawCoverage[h] = &scriptRawCoverage{debugInfo: di} rawCoverage[h] = &scriptRawCoverage{debugInfo: di}

View file

@ -12,13 +12,11 @@ import (
"github.com/nspcc-dev/neo-go/pkg/vm/opcode" "github.com/nspcc-dev/neo-go/pkg/vm/opcode"
) )
var rawCoverage = make(map[scriptHash]*scriptRawCoverage) var rawCoverage = make(map[util.Uint160]*scriptRawCoverage)
var enabled bool var enabled bool
var coverProfile = "" var coverProfile = ""
type scriptHash = util.Uint160
type scriptRawCoverage struct { type scriptRawCoverage struct {
debugInfo *compiler.DebugInfo debugInfo *compiler.DebugInfo
offsetsVisited []int offsetsVisited []int
@ -55,8 +53,8 @@ func isCoverageEnabled() bool {
} }
func coverageHook() vm.OnExecHook { func coverageHook() vm.OnExecHook {
return func(sh scriptHash, offset int, opcode opcode.Opcode) { return func(scriptHash util.Uint160, offset int, opcode opcode.Opcode) {
if cov, ok := rawCoverage[sh]; ok { if cov, ok := rawCoverage[scriptHash]; ok {
cov.offsetsVisited = append(cov.offsetsVisited, offset) cov.offsetsVisited = append(cov.offsetsVisited, offset)
} }
} }