@@ -149,6 +149,30 @@ func loadAccounts(filePath string) ([]*types.AccountCurrency, error) {
149149 return accounts , nil
150150}
151151
152+ // loadAccount is a utility function to parse the []*types.AccountCurrency
153+ // from a string.
154+ func loadAccount (accountAddress string ) []* types.AccountCurrency {
155+ if len (accountAddress ) == 0 {
156+ return []* types.AccountCurrency {}
157+ }
158+
159+ accounts := []* types.AccountCurrency {}
160+ accountIndentifier := & types.AccountIdentifier {
161+ Address : accountAddress ,
162+ // You can set other fields of AccountIdentifier here if needed.
163+ }
164+
165+ // Create an AccountCurrency instance with the Account field set to the created AccountIdentifier.
166+ targetAccount := & types.AccountCurrency {
167+ Account : accountIndentifier ,
168+ // You can set other fields of AccountCurrency here if needed.
169+ }
170+
171+ accounts = append (accounts , targetAccount )
172+
173+ return accounts
174+ }
175+
152176// CloseDatabase closes the database used by DataTester.
153177func (t * DataTester ) CloseDatabase (ctx context.Context ) {
154178 if err := t .database .Close (ctx ); err != nil {
@@ -249,6 +273,14 @@ func InitializeData(
249273 color .Red (err .Error ())
250274 return nil , err
251275 }
276+ if len (config .TargetAccount ) != 0 {
277+ interestingAccounts = loadAccount (config .TargetAccount )
278+ }
279+
280+ interestingOnly := false
281+ if len (interestingAccounts ) != 0 {
282+ interestingOnly = true
283+ }
252284
253285 counterStorage := modules .NewCounterStorage (localStore )
254286 blockStorage := modules .NewBlockStorage (localStore , config .SerialBlockWorkers )
@@ -357,11 +389,17 @@ func InitializeData(
357389 counterStorage ,
358390 historicalBalanceEnabled ,
359391 exemptAccounts ,
360- false ,
392+ interestingOnly ,
361393 networkOptions .Allow .BalanceExemptions ,
362394 config .Data .InitialBalanceFetchDisabled ,
363395 )
364396
397+ if interestingOnly {
398+ for _ , interesinterestingAccount := range interestingAccounts {
399+ balanceStorageHelper .AddInterestingAddress (interesinterestingAccount .Account .Address )
400+ }
401+ }
402+
365403 balanceStorageHandler := processor .NewBalanceStorageHandler (
366404 logger ,
367405 r ,
0 commit comments