-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
44 lines (38 loc) · 1.15 KB
/
main.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
43
44
package main
import (
"github.com/sedracoin/sedrad/infrastructure/network/rpcclient/grpcclient"
"github.com/sedracoin/sedrad/stability-tests/common"
"github.com/sedracoin/sedrad/util/panics"
"github.com/sedracoin/sedrad/util/profiling"
"github.com/pkg/errors"
)
func main() {
defer panics.HandlePanic(log, "rpc-stability-main", nil)
err := parseConfig()
if err != nil {
panic(errors.Wrap(err, "error parsing configuration"))
}
defer backendLog.Close()
common.UseLogger(backendLog, log.Level())
cfg := activeConfig()
if cfg.Profile != "" {
profiling.Start(cfg.Profile, log)
}
rpcAddress, err := cfg.NetParams().NormalizeRPCServerAddress(cfg.RPCServer)
if err != nil {
panic(errors.Wrap(err, "error parsing RPC server address"))
}
rpcClient, err := grpcclient.Connect(rpcAddress)
if err != nil {
panic(errors.Wrap(err, "error connecting to RPC server"))
}
defer rpcClient.Disconnect()
commandsChan, err := readCommands()
if err != nil {
panic(errors.Wrapf(err, "error reading commands from file %s", cfg.CommandsFilePath))
}
err = sendCommands(rpcClient, commandsChan)
if err != nil {
panic(errors.Wrap(err, "error sending commands"))
}
}