@@ -8,13 +8,13 @@ import (
88 "github.com/mr-tron/base58/base58"
99 "github.com/newrelic/go-agent/v3/newrelic"
1010
11+ "github.com/code-payments/code-server/pkg/code/data/nonce"
12+ "github.com/code-payments/code-server/pkg/code/data/transaction"
1113 "github.com/code-payments/code-server/pkg/database/query"
1214 "github.com/code-payments/code-server/pkg/metrics"
1315 "github.com/code-payments/code-server/pkg/retry"
1416 "github.com/code-payments/code-server/pkg/solana"
1517 "github.com/code-payments/code-server/pkg/solana/system"
16- "github.com/code-payments/code-server/pkg/code/data/nonce"
17- "github.com/code-payments/code-server/pkg/code/data/transaction"
1818)
1919
2020func (p * service ) worker (serviceCtx context.Context , state nonce.State , interval time.Duration ) error {
@@ -131,19 +131,21 @@ func (p *service) handle(ctx context.Context, record *nonce.Record) error {
131131func (p * service ) handleUnknown (ctx context.Context , record * nonce.Record ) error {
132132 // Newly created nonces.
133133
134- // Check the signature for a potential timeout (e.g. if the nonce account
135- // was never created because the blockchain never saw the init/create
136- // transaction)
137- err := p .checkForMissingTx (ctx , record )
138- if err != nil {
139- return p .markInvalid (ctx , record )
140- }
141-
142134 // We're going to the blockchain directly here (super slow btw)
143135 // because we don't capture the transaction through history yet (it only
144136 // grabs transfer style transactions for KIN accounts).
145137 stx , err := p .data .GetBlockchainTransaction (ctx , record .Signature , solana .CommitmentFinalized )
146- if err != nil {
138+ if err == solana .ErrSignatureNotFound {
139+ // Check the signature for a potential timeout (e.g. if the nonce account
140+ // was never created because the blockchain never saw the init/create
141+ // transaction)
142+ err := p .checkForMissingTx (ctx , record )
143+ if err != nil {
144+ return p .markInvalid (ctx , record )
145+ }
146+
147+ return nil
148+ } else if err != nil {
147149 return err
148150 }
149151
0 commit comments