Skip to content

Commit 319cd6b

Browse files
authored
fix UI wallet name on actor detail page (#455)
1 parent ac01fcb commit 319cd6b

File tree

1 file changed

+14
-28
lines changed

1 file changed

+14
-28
lines changed

web/api/webrpc/actor_summary.go

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import (
44
"bytes"
55
"context"
66
"sort"
7-
"sync"
87

98
"github.com/multiformats/go-multiaddr"
10-
"golang.org/x/sync/errgroup"
119
"golang.org/x/xerrors"
1210

1311
"github.com/filecoin-project/go-address"
@@ -106,9 +104,10 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
106104
return
107105
}
108106
for name, aset := range map[string][]string{
109-
layer + ":Commit": cAddrs.PreCommitControl,
110-
layer + ":Control": cAddrs.CommitControl,
111-
layer + ":Terminate": cAddrs.TerminateControl,
107+
layer + ":PreCommit": cAddrs.PreCommitControl,
108+
layer + ":Commit": cAddrs.CommitControl,
109+
layer + ":DealPublish:": cAddrs.DealPublishControl,
110+
layer + ":Terminate": cAddrs.TerminateControl,
112111
} {
113112
for _, addrStr := range aset {
114113
addr, err := address.NewFromString(addrStr)
@@ -190,10 +189,6 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
190189
processedAddrs := make(map[address.Address]struct{})
191190

192191
var wallets []WalletInfo
193-
var akm, bcm, mu sync.Mutex
194-
195-
// Use errgroup for error handling with goroutines
196-
g, ctx := errgroup.WithContext(ctx)
197192

198193
// Helper functions
199194
getAccountKey := func(addr address.Address) (address.Address, error) {
@@ -204,9 +199,7 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
204199
if err != nil {
205200
return address.Undef, err
206201
}
207-
akm.Lock()
208202
accountKeyMap[addr] = ak
209-
akm.Unlock()
210203
return ak, nil
211204
}
212205

@@ -218,9 +211,7 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
218211
if err != nil {
219212
return big.Int{}, err
220213
}
221-
bcm.Lock()
222214
balanceCache[addr] = bal
223-
bcm.Unlock()
224215
return bal, nil
225216
}
226217

@@ -234,8 +225,6 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
234225
return err
235226
}
236227

237-
mu.Lock()
238-
defer mu.Unlock()
239228
if _, exists := processedAddrs[ak]; !exists {
240229
processedAddrs[ak] = struct{}{}
241230
wallets = append(wallets, WalletInfo{
@@ -250,25 +239,22 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
250239
// Process minerWallets
251240
for name, addrs := range minerWallets {
252241
for _, addr := range addrs {
253-
addr := addr // Avoid closure issues
242+
addr := addr
254243
name := name
255-
g.Go(func() error {
256-
return processAddress(addr, name)
257-
})
244+
err = processAddress(addr, name)
245+
if err != nil {
246+
return nil, xerrors.Errorf("processing address: %w", err)
247+
}
258248
}
259249
}
260250

261251
// Process ControlAddresses
262252
for _, addr := range append(info.ControlAddresses, info.Worker, info.Owner, info.Beneficiary) {
263-
addr := addr // Avoid closure issues
264-
g.Go(func() error {
265-
return processAddress(addr, "Control")
266-
})
267-
}
268-
269-
// Wait for all goroutines to complete
270-
if err := g.Wait(); err != nil {
271-
return nil, xerrors.Errorf("processing addresses: %w", err)
253+
addr := addr
254+
err = processAddress(addr, "Control")
255+
if err != nil {
256+
return nil, xerrors.Errorf("processing address: %w", err)
257+
}
272258
}
273259

274260
wbal, err := getWalletBalance(accountKeyMap[info.Worker])

0 commit comments

Comments
 (0)