@@ -4,10 +4,8 @@ import (
4
4
"bytes"
5
5
"context"
6
6
"sort"
7
- "sync"
8
7
9
8
"github.com/multiformats/go-multiaddr"
10
- "golang.org/x/sync/errgroup"
11
9
"golang.org/x/xerrors"
12
10
13
11
"github.com/filecoin-project/go-address"
@@ -106,9 +104,10 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
106
104
return
107
105
}
108
106
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 ,
112
111
} {
113
112
for _ , addrStr := range aset {
114
113
addr , err := address .NewFromString (addrStr )
@@ -190,10 +189,6 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
190
189
processedAddrs := make (map [address.Address ]struct {})
191
190
192
191
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 )
197
192
198
193
// Helper functions
199
194
getAccountKey := func (addr address.Address ) (address.Address , error ) {
@@ -204,9 +199,7 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
204
199
if err != nil {
205
200
return address .Undef , err
206
201
}
207
- akm .Lock ()
208
202
accountKeyMap [addr ] = ak
209
- akm .Unlock ()
210
203
return ak , nil
211
204
}
212
205
@@ -218,9 +211,7 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
218
211
if err != nil {
219
212
return big.Int {}, err
220
213
}
221
- bcm .Lock ()
222
214
balanceCache [addr ] = bal
223
- bcm .Unlock ()
224
215
return bal , nil
225
216
}
226
217
@@ -234,8 +225,6 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
234
225
return err
235
226
}
236
227
237
- mu .Lock ()
238
- defer mu .Unlock ()
239
228
if _ , exists := processedAddrs [ak ]; ! exists {
240
229
processedAddrs [ak ] = struct {}{}
241
230
wallets = append (wallets , WalletInfo {
@@ -250,25 +239,22 @@ func (a *WebRPC) ActorInfo(ctx context.Context, ActorIDstr string) (*ActorDetail
250
239
// Process minerWallets
251
240
for name , addrs := range minerWallets {
252
241
for _ , addr := range addrs {
253
- addr := addr // Avoid closure issues
242
+ addr := addr
254
243
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
+ }
258
248
}
259
249
}
260
250
261
251
// Process ControlAddresses
262
252
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
+ }
272
258
}
273
259
274
260
wbal , err := getWalletBalance (accountKeyMap [info .Worker ])
0 commit comments