internal: avoid race access to config.Version by tests

Network server constructor reads config.Version variable, and
testcli.DeployContract writes dummy config.Version which causes
race in tests. Avoid this race by moving config.Version initialisation
to a separate package and perform it inside test packages init().

Close #3011, close #3017.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-08-29 20:39:27 +03:00
parent 91c928e8d3
commit eeb439f548
8 changed files with 34 additions and 35 deletions

View file

@ -340,7 +340,6 @@ func (e *Executor) CheckScriptDump(t *testing.T, scriptSize int) {
}
func DeployContract(t *testing.T, e *Executor, inPath, configPath, wallet, address, pass string) util.Uint160 {
config.Version = "0.90.0-test" // Contracts are compiled and we want NEFs to not change from run to run.
tmpDir := t.TempDir()
nefName := filepath.Join(tmpDir, "contract.nef")
manifestName := filepath.Join(tmpDir, "contract.manifest.json")