-
Notifications
You must be signed in to change notification settings - Fork 3
/
batch.go
42 lines (35 loc) · 869 Bytes
/
batch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package cmd
import (
"fmt"
"io/ioutil"
"github.com/bianjieai/tibc-relayer-go/cmd/handlers"
"github.com/spf13/cobra"
)
var (
endHeight uint64
batchCmd = &cobra.Command{
Use: "batch",
Short: "Manual batch send update eth tx",
Run: func(cmd *cobra.Command, args []string) {
batchUpdateETHClient()
},
}
)
func init() {
rootCmd.AddCommand(batchCmd)
batchCmd.Flags().StringVarP(&localConfig, "CONFIG", "c", "", "config path: /opt/local.toml")
batchCmd.Flags().Uint64VarP(&endHeight, "END", "e", 0, "ethereum ending height")
}
func batchUpdateETHClient() {
data, err := ioutil.ReadFile(localConfig)
if err != nil {
fmt.Println("Error: get config data error: ", err)
return
}
config, err := readConfig(data)
if err != nil {
fmt.Println("Error: read config error: ", err)
return
}
handlers.BatchUpdateETHClient(config, endHeight)
}