Skip to content

Commit f16e5a5

Browse files
committed
Save a DB call on Airdrop by making the intent initially pending
1 parent 2334ffa commit f16e5a5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/code/server/transaction/airdrop.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func (s *transactionServer) airdrop(ctx context.Context, intentId string, owner
319319

320320
InitiatorOwnerAccount: s.airdropper.VaultOwner.PublicKey().ToBase58(),
321321

322-
State: intent.StateUnknown,
322+
State: intent.StatePending,
323323

324324
CreatedAt: time.Now(),
325325
}
@@ -390,9 +390,7 @@ func (s *transactionServer) airdrop(ctx context.Context, intentId string, owner
390390
return err
391391
}
392392

393-
// Intent is pending only after everything's been saved.
394-
intentRecord.State = intent.StatePending
395-
return s.data.SaveIntent(ctx, intentRecord)
393+
return nil
396394
})
397395
if err != nil {
398396
log.WithError(err).Warn("failure creating airdrop intent")

0 commit comments

Comments
 (0)