Skip to content

Commit

Permalink
check initiator at spam control
Browse files Browse the repository at this point in the history
  • Loading branch information
akos-tk committed Nov 13, 2024
1 parent af84b4f commit 12cad02
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/api/event_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ func (h *Handler) toEvent(ctx context.Context, trace *core.Trace, result *bath.A
}
event.Actions[i] = convertedAction
}
event.IsScam = h.spamFilter.CheckActions(event.Actions, nil)
event.IsScam = h.spamFilter.CheckActions(event.Actions, nil, trace.Account)
previews := make(map[tongo.AccountID]oas.JettonPreview)
for _, flow := range result.ValueFlow.Accounts {
for jettonMaster := range flow.Jettons {
Expand Down Expand Up @@ -849,7 +849,7 @@ func (h *Handler) toAccountEvent(ctx context.Context, account tongo.AccountID, t
e.Actions = append(e.Actions, convertedAction)
}
if h.spamFilter != nil {
e.IsScam = h.spamFilter.CheckActions(e.Actions, &account)
e.IsScam = h.spamFilter.CheckActions(e.Actions, &account, trace.Account)
}
if len(e.Actions) == 0 {
e.Actions = []oas.Action{
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ type ratesSource interface {
}

type SpamFilter interface {
CheckActions(actions []oas.Action, viewer *ton.AccountID) bool
CheckActions(actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool
JettonTrust(address tongo.AccountID, symbol, name, image string) core.TrustType
NftTrust(address tongo.AccountID, collection *ton.AccountID, description, image string) core.TrustType
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/jetton_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (h *Handler) convertJettonHistory(ctx context.Context, account ton.AccountI
}
event.Actions = append(event.Actions, convertedAction)
}
event.IsScam = h.spamFilter.CheckActions(event.Actions, &account)
event.IsScam = h.spamFilter.CheckActions(event.Actions, &account, trace.Account)
if len(event.Actions) == 0 {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/nft_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (h *Handler) convertNftHistory(ctx context.Context, account tongo.AccountID
}
event.Actions = append(event.Actions, convertedAction)
}
event.IsScam = h.spamFilter.CheckActions(event.Actions, &account)
event.IsScam = h.spamFilter.CheckActions(event.Actions, &account, trace.Account)
if len(event.Actions) > 0 {
events = append(events, event)
lastLT = trace.Lt
Expand Down
2 changes: 1 addition & 1 deletion pkg/spam/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func NewSpamFilter() *Filter {
}
}

func (f Filter) CheckActions(actions []oas.Action, viewer *ton.AccountID) bool {
func (f Filter) CheckActions(actions []oas.Action, viewer *ton.AccountID, initiator ton.AccountID) bool {
var comment string
for _, action := range actions {
switch {
Expand Down

0 comments on commit 12cad02

Please sign in to comment.