Skip to content

Commit 738ce26

Browse files
authored
Remove time-based swap messaging logic (#102)
1 parent b93920e commit 738ce26

File tree

1 file changed

+0
-13
lines changed
  • pkg/code/server/grpc/transaction/v2

1 file changed

+0
-13
lines changed

pkg/code/server/grpc/transaction/v2/swap.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ import (
3636
"github.com/code-payments/code-server/pkg/usdc"
3737
)
3838

39-
var (
40-
swapNotificationTimeByOwner = make(map[string]time.Time)
41-
)
42-
4339
func (s *transactionServer) Swap(streamer transactionpb.Transaction_SwapServer) error {
4440
ctx, cancel := context.WithTimeout(streamer.Context(), s.conf.swapTimeout.Get(streamer.Context()))
4541
defer cancel()
@@ -493,15 +489,6 @@ func (s *transactionServer) validateSwap(
493489
}
494490

495491
func (s *transactionServer) bestEffortNotifyUserOfSwapInProgress(ctx context.Context, owner *common.Account) error {
496-
// Avoid spamming users chat messages due to retries of the Swap RPC within
497-
// small periods of time. Implementation isn't perfect, but we'll be updating
498-
// notifications later anyways.
499-
lastNotificationTs, ok := swapNotificationTimeByOwner[owner.PublicKey().ToBase58()]
500-
if ok && time.Since(lastNotificationTs) < time.Minute {
501-
return nil
502-
}
503-
swapNotificationTimeByOwner[owner.PublicKey().ToBase58()] = time.Now()
504-
505492
chatId := chat_util.GetKinPurchasesChatId(owner)
506493

507494
// Inspect the chat history for a USDC deposited message. If that message

0 commit comments

Comments
 (0)