fix: need to manually process address slice
This commit is contained in:
parent
1e94f378f3
commit
5ed286a639
16
node/node.go
16
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 {
|
||||
|
|
Loading…
Reference in New Issue