Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: duplicate message #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions modules/filscan/biz/browser/biz_output_imtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,10 @@ func (i IMTokenBiz) ChainMessages(ctx context.Context, req filscan.ChainMessages
if err != nil || transfers == nil {
return
}
var transferList []*filscan.MessageBasic
if transfers != nil {
transferList = transfers.TracesByAccountIDList
}
transferList := transfers.TracesByAccountIDList

cidMethod := make(map[string]string)
uniq := make(map[string]struct{})
var runners []parallel.Runner[filscan.MessageByCidResponse]
for _, transfer := range transferList {
cid := transfer.Cid
Expand All @@ -216,7 +215,10 @@ func (i IMTokenBiz) ChainMessages(ctx context.Context, req filscan.ChainMessages
ch := parallel.Run[filscan.MessageByCidResponse](ctx, 50, runners)
err = parallel.Wait[filscan.MessageByCidResponse](ch, func(v filscan.MessageByCidResponse) error {
if v.Message != nil {
resp.MessageList = append(resp.MessageList, v.Message)
if _, ok := uniq[v.Message.Cid]; !ok {
uniq[v.Message.Cid] = struct{}{}
resp.MessageList = append(resp.MessageList, v.Message)
}
}
return nil
})
Expand All @@ -239,7 +241,7 @@ func (i IMTokenBiz) ChainMessages(ctx context.Context, req filscan.ChainMessages
}
}
for index := 1; index < len(resp.MessageList); index++ {
//给每个消息打标签,避免通过cid找消息将recieve这种变成了send
//给每个消息打标签,避免通过cid找消息将receive这种变成了send
messageIMToken := resp.MessageList[index]
if messageIMToken.Cid != "" {
messageIMToken.Method = cidMethod[messageIMToken.Cid]
Expand Down