From 577d1be57caf140bdbef1d5baf1698a92e56e260 Mon Sep 17 00:00:00 2001 From: ilija Date: Tue, 14 Jan 2025 19:28:17 +0100 Subject: [PATCH] Reorder codec init in lp Register Filter --- pkg/solana/logpoller/filters.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/solana/logpoller/filters.go b/pkg/solana/logpoller/filters.go index ba82e11f5..3991f28f5 100644 --- a/pkg/solana/logpoller/filters.go +++ b/pkg/solana/logpoller/filters.go @@ -14,9 +14,7 @@ import ( "github.com/gagliardetto/solana-go" - "github.com/smartcontractkit/chainlink-common/pkg/codec/encodings/binary" "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/codec" ) @@ -111,13 +109,6 @@ func (fl *filters) RegisterFilter(ctx context.Context, filter Filter) error { fl.removeFilterFromIndexes(*existingFilter) } - filterID, err := fl.orm.InsertFilter(ctx, filter) - if err != nil { - return fmt.Errorf("failed to insert filter: %w", err) - } - - filter.ID = filterID - cEntry, err := codec.NewEventArgsEntry(filter.EventName, filter.EventIdl.EventIDLTypes, true, nil, binary.LittleEndian()) if err != nil { return err @@ -129,6 +120,13 @@ func (fl *filters) RegisterFilter(ctx context.Context, filter Filter) error { return fmt.Errorf("failed to create event decoder: %w", err) } + filterID, err := fl.orm.InsertFilter(ctx, filter) + if err != nil { + return fmt.Errorf("failed to insert filter: %w", err) + } + + filter.ID = filterID + fl.decoders[filter.ID] = decoder fl.filtersByName[filter.Name] = filter.ID fl.filtersByID[filter.ID] = &filter