Skip to content

Commit

Permalink
polish(sentinel): add mode for building lotus in sentinel mode
Browse files Browse the repository at this point in the history
- replaces the sentinel flag on daemon command.
  • Loading branch information
frrist committed Feb 24, 2021
1 parent e3a757b commit c8a92fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,11 @@ docsgen:

print-%:
@echo $*=$($*)

# Sentinel build mode
lotus-sentinel: $(BUILD_DEPS)
rm -f lotus
go build $(GOFLAGS) -ldflags="-X=github.com/filecoin-project/lotus/build.SentinelMode=true" -o lotus ./cmd/lotus
go run github.com/GeertJohan/go.rice/rice append --exec lotus -i ./build

.PHONY: lotus
3 changes: 3 additions & 0 deletions build/sentinel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package build

var SentinelMode string = "false"
10 changes: 5 additions & 5 deletions cmd/lotus/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/http"
"os"
"runtime/pprof"
"strconv"
"strings"

paramfetch "github.com/filecoin-project/go-paramfetch"
Expand Down Expand Up @@ -128,10 +129,6 @@ var DaemonCmd = &cli.Command{
Usage: "start lotus in lite mode",
Hidden: true,
},
&cli.BoolFlag{
Name: "sentinel",
Usage: "start lotus in sentinel mode.",
},
&cli.StringFlag{
Name: "pprof",
Usage: "specify name of file for writing cpu profile to",
Expand Down Expand Up @@ -517,7 +514,10 @@ func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool)

func getDaemonMode(cctx *cli.Context) (daemonMode, error) {
isLite := cctx.Bool("lite")
isSentinel := cctx.Bool("sentinel")
isSentinel, err := strconv.ParseBool(build.SentinelMode)
if err != nil {
return modeUnknown, err
}

switch {
case !isLite && !isSentinel:
Expand Down

0 comments on commit c8a92fd

Please sign in to comment.