diff --git a/cmd/process.go b/cmd/process.go index ccbe60f..5fe466f 100644 --- a/cmd/process.go +++ b/cmd/process.go @@ -102,7 +102,6 @@ func (p *Processor) StartProcessor(cfg config.Config, logger log.Logger, process var batchPosition int // if this is the first time seeing this tx hash, add the message to State - // msg, ok := State.Load(LookupKey(dequeuedMsg.SourceTxHash, dequeuedMsg.Type, sha256.Sum256(dequeuedMsg.MsgSentBytes))) msg, ok := State.Load(dequeuedMsg.SourceTxHash) if !ok { batchPosition = 0 diff --git a/types/state_test.go b/types/state_test.go index 985deb2..1d87cde 100644 --- a/types/state_test.go +++ b/types/state_test.go @@ -6,11 +6,17 @@ import ( "github.com/stretchr/testify/require" ) -func TestX(t *testing.T) { +func TestStateHandling(t *testing.T) { stateMap := NewStateMap() txHash := "123456789" - msg := MessageState{SourceTxHash: txHash, IrisLookupId: "123", Status: Filtered, MsgSentBytes: []byte("i like turtles")} + msg := MessageState{ + SourceTxHash: txHash, + IrisLookupId: "123", + Status: Filtered, + MsgSentBytes: []byte("i like turtles"), + } + stateMap.Store(txHash, []*MessageState{&msg}) loadedMsg, _ := stateMap.Load(txHash) @@ -24,7 +30,13 @@ func TestX(t *testing.T) { require.Equal(t, Complete, loadedMsg2[0].Status) // even though loadedMsg is a pointer, if we add to the array, we need to re-store in cache. - msg2 := MessageState{SourceTxHash: txHash, IrisLookupId: "123", Status: Filtered, MsgSentBytes: []byte("mock bytes 2")} + msg2 := MessageState{ + SourceTxHash: txHash, + IrisLookupId: "123", + Status: Filtered, + MsgSentBytes: []byte("mock bytes 2"), + } + loadedMsg = append(loadedMsg, &msg2) stateMap.Store(txHash, loadedMsg)