From 004d008e2bd996e5b22b0ec07318786603386887 Mon Sep 17 00:00:00 2001 From: Alexander Cristurean Date: Fri, 27 Sep 2024 07:38:16 +0300 Subject: [PATCH] fix linter issues. --- state/stateChanges/dataAnalysisCollector.go | 4 +--- state/stateChanges/writeCollector_test.go | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/state/stateChanges/dataAnalysisCollector.go b/state/stateChanges/dataAnalysisCollector.go index a81633d462e..481eb8e9fc6 100644 --- a/state/stateChanges/dataAnalysisCollector.go +++ b/state/stateChanges/dataAnalysisCollector.go @@ -134,9 +134,7 @@ func (scc *dataAnalysisCollector) getDataAnalysisStateChangesForTxs() ([]dataAna dataAnalysisStateChangesForTxs := make([]dataAnalysisStateChangesForTx, 0) for _, stateChangeForTx := range stateChangesForTxs { - txHash := string(stateChangeForTx.TxHash) - - cachedTx, txOk := scc.cachedTxs[txHash] + cachedTx, txOk := scc.cachedTxs[string(stateChangeForTx.TxHash)] if !txOk { return nil, fmt.Errorf("did not find tx in cache") } diff --git a/state/stateChanges/writeCollector_test.go b/state/stateChanges/writeCollector_test.go index 4414ca2f911..1dc76a124c7 100644 --- a/state/stateChanges/writeCollector_test.go +++ b/state/stateChanges/writeCollector_test.go @@ -7,9 +7,10 @@ import ( data "github.com/multiversx/mx-chain-core-go/data/stateChange" "github.com/multiversx/mx-chain-core-go/data/transaction" - "github.com/multiversx/mx-chain-go/state" "github.com/stretchr/testify/assert" + "github.com/multiversx/mx-chain-go/state" + "github.com/stretchr/testify/require" ) @@ -276,7 +277,7 @@ func TestStateChangesCollector_GetStateChangesForTx(t *testing.T) { require.Equal(t, stateChangesForTx, map[string]*data.StateChanges{ "hash0": { - []*data.StateChange{ + StateChanges: []*data.StateChange{ {Type: "write", TxHash: []byte("hash0")}, {Type: "write", TxHash: []byte("hash0")}, {Type: "write", TxHash: []byte("hash0")}, @@ -285,7 +286,7 @@ func TestStateChangesCollector_GetStateChangesForTx(t *testing.T) { }, }, "hash1": { - []*data.StateChange{ + StateChanges: []*data.StateChange{ {Type: "write", TxHash: []byte("hash1")}, {Type: "write", TxHash: []byte("hash1")}, {Type: "write", TxHash: []byte("hash1")},