github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/pkg/decache/locations_from_traces.go (about) 1 package decache 2 3 import ( 4 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base" 5 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/cache" 6 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/identifiers" 7 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/rpc" 8 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" 9 ) 10 11 func LocationsFromTraces(conn *rpc.Connection, ids []identifiers.Identifier) ([]cache.Locator, error) { 12 locations := make([]cache.Locator, 0) 13 for _, br := range ids { 14 blockNums, err := br.ResolveBlocks(conn.Chain) 15 if err != nil { 16 return nil, err 17 } 18 for _, bn := range blockNums { 19 // walk.Cache_Traces 20 traceGroup := &types.TraceGroup{ 21 BlockNumber: bn, 22 TransactionIndex: base.NOPOSN, 23 } 24 locations = append(locations, traceGroup) 25 } 26 } 27 return locations, nil 28 }