erigon-pulse/cmd/headers/commands/download.go
ledgerwatch 7554428884
POC of header downloader - splitting into 2 processes: sentry + downloader (via gRPC) (#1291)
* Splitting sentry and downloader - the beginning

* A bit more

* More on sentry

* More gRPC

* Sentry and downloader separated

* Update binding for stable version of grpc

* Better bufferSize flag

* Fix lint

* Send pelanties

* Fix lint

* Remove hard-coded tips on connect

* Tidy the logs a bit

* Deal with hardTips on Recovery

* Print hard tips

* Hide empty anchors

* Request headers after receiving a message

* Better waking up

* Print hard-coded block numbers

* Print outgoing requests

* Debug logging

* In the middle protection

* Sentry not to lose peers when core disconnects
2020-10-25 22:05:37 +00:00

27 lines
846 B
Go

package commands
import (
"github.com/ledgerwatch/turbo-geth/cmd/headers/download"
"github.com/spf13/cobra"
)
var (
bufferSizeStr string // Size of buffer
)
func init() {
downloadCmd.Flags().StringVar(&filesDir, "filesdir", "", "path to directory where files will be stored")
downloadCmd.Flags().StringVar(&bufferSizeStr, "bufferSize", "512M", "size o the buffer")
downloadCmd.Flags().StringVar(&sentryAddr, "sentryAddr", "localhost:9091", "sentry address <host>:<port>")
downloadCmd.Flags().StringVar(&coreAddr, "coreAddr", "localhost:9092", "core address <host>:<port>")
rootCmd.AddCommand(downloadCmd)
}
var downloadCmd = &cobra.Command{
Use: "download",
Short: "Download headers backwards",
RunE: func(cmd *cobra.Command, args []string) error {
return download.Download(filesDir, bufferSizeStr, sentryAddr, coreAddr)
},
}