diff --git a/node/node.go b/node/node.go index 13aece4..1077af3 100644 --- a/node/node.go +++ b/node/node.go @@ -121,7 +121,6 @@ func (n *NodeImpl) GetCachedStorageLocations(hash *encoding.Multihash, kinds []t ts := time.Now().Unix() for _, t := range kinds { - nodeMap, ok := (locationMap)[int(t)] if !ok { continue @@ -137,11 +136,24 @@ func (n *NodeImpl) GetCachedStorageLocations(hash *encoding.Multihash, kinds []t continue } - addresses, ok := value[1].([]string) + addressesInterface, ok := value[1].([]interface{}) if !ok { continue } + // Create a slice to hold the strings + addresses := make([]string, len(addressesInterface)) + + // Convert each element to string + for i, v := range addressesInterface { + str, ok := v.(string) + if !ok { + // Handle the error, maybe skip this element or set a default value + continue + } + addresses[i] = str + } + storageLocation := storage.NewStorageLocation(int(t), addresses, expiry) if len(value) > 4 { if providerMessage, ok := value[4].([]byte); ok {