erigon-pulse/cmd/snapshots/sync/util.go

33 lines
450 B
Go
Raw Normal View History

2023-12-27 22:05:09 +00:00
package sync
import (
"context"
"fmt"
"github.com/ledgerwatch/erigon-lib/downloader"
)
func CheckRemote(rcCli *downloader.RCloneClient, src string) error {
remotes, err := rcCli.ListRemotes(context.Background())
if err != nil {
return err
}
hasRemote := false
for _, remote := range remotes {
if src == remote {
hasRemote = true
break
}
}
if !hasRemote {
return fmt.Errorf("unknown remote: %s", src)
}
return nil
}