Skip to content

Commit

Permalink
minor comment improvement in package cmd/thor (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
libotony authored May 24, 2024
1 parent cfac49d commit 516b3a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/thor/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var (
}
bootNodeFlag = cli.StringFlag{
Name: "bootnode",
Usage: "comma separated list of bootnode IDs",
Usage: "comma separated list of bootstrap node IDs",
}
allowedPeersFlag = cli.StringFlag{
Name: "allowed-peers",
Expand Down
4 changes: 2 additions & 2 deletions cmd/thor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func defaultAction(ctx *cli.Context) error {

skipLogs := ctx.Bool(skipLogsFlag.Name)

logDB, err := openLogDB(ctx, instanceDir)
logDB, err := openLogDB(instanceDir)
if err != nil {
return err
}
Expand Down Expand Up @@ -314,7 +314,7 @@ func soloAction(ctx *cli.Context) error {
}
defer func() { log.Info("closing main database..."); mainDB.Close() }()

if logDB, err = openLogDB(ctx, instanceDir); err != nil {
if logDB, err = openLogDB(instanceDir); err != nil {
return err
}
defer func() { log.Info("closing log database..."); logDB.Close() }()
Expand Down
11 changes: 5 additions & 6 deletions cmd/thor/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ func New(
opts.DiscoveryNodes = nil
opts.KnownNodes = allowedPeers
} else {
// boot nodes flag will overwrite the default bootstrap nodes and also disable remote bootstrap
// bootstrap nodes will be connected for discovery and for p2p protocols
// bootstrap nodes flag will overwrite the default discovery nodes and also disable remote discovery
if len(bootstrapNodes) > 0 {
opts.RemoteDiscoveryList = "" // disable remote bootstrap
opts.DiscoveryNodes = bootstrapNodes // discovery nodes are unused given that known nodes are used for both node discovery and p2p protocol
opts.KnownNodes = bootstrapNodes // bootstrap nodes will be used for discovery and p2p
opts.RemoteDiscoveryList = "" // disable remote discovery
opts.DiscoveryNodes = bootstrapNodes // overwrite the default discovery nodes
opts.KnownNodes = bootstrapNodes // supplied bootstrap nodes can potentially be p2p node, add to the known nodes
}

// cached peers will be appended to existing or flag-set bootnodes
// cached peers will be appended to existing or flag-set bootstrap nodes
if len(cachedPeers) > 0 {
opts.KnownNodes = dedupNodeSlice(opts.KnownNodes, cachedPeers)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/thor/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func suggestFDCache() int {
return n
}

func openLogDB(ctx *cli.Context, dir string) (*logdb.LogDB, error) {
func openLogDB(dir string) (*logdb.LogDB, error) {
path := filepath.Join(dir, "logs.db")
db, err := logdb.New(path)
if err != nil {
Expand Down

0 comments on commit 516b3a8

Please sign in to comment.