diff --git a/cmd/tendermint/commands/reset_priv_validator.go b/cmd/tendermint/commands/reset_priv_validator.go index 6255f9613..b9c08715f 100644 --- a/cmd/tendermint/commands/reset_priv_validator.go +++ b/cmd/tendermint/commands/reset_priv_validator.go @@ -27,7 +27,7 @@ var ResetPrivValidatorCmd = &cobra.Command{ // ResetAll removes the privValidator files. // Exported so other CLI tools can use it func ResetAll(dbDir, privValFile string, logger log.Logger) { - resetPrivValidatorLocal(privValFile, logger) + resetPrivValidatorFS(privValFile, logger) os.RemoveAll(dbDir) logger.Info("Removed all data", "dir", dbDir) } @@ -41,10 +41,10 @@ func resetAll(cmd *cobra.Command, args []string) { // XXX: this is totally unsafe. // it's only suitable for testnets. func resetPrivValidator(cmd *cobra.Command, args []string) { - resetPrivValidatorLocal(config.PrivValidatorFile(), logger) + resetPrivValidatorFS(config.PrivValidatorFile(), logger) } -func resetPrivValidatorLocal(privValFile string, logger log.Logger) { +func resetPrivValidatorFS(privValFile string, logger log.Logger) { // Get PrivValidator if _, err := os.Stat(privValFile); err == nil { privValidator := types.LoadPrivValidatorFS(privValFile) diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index b3ef821aa..f0a1eede2 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -5,10 +5,7 @@ import ( "github.com/spf13/cobra" - cfg "github.com/tendermint/tendermint/config" nm "github.com/tendermint/tendermint/node" - "github.com/tendermint/tendermint/proxy" - "github.com/tendermint/tendermint/types" ) // AddNodeFlags exposes some common configuration options on the command-line @@ -39,27 +36,15 @@ func AddNodeFlags(cmd *cobra.Command) { cmd.Flags().Bool("consensus.create_empty_blocks", config.Consensus.CreateEmptyBlocks, "Set this to false to only produce blocks when there are txs or when the AppHash changes") } -// FuncSignerAndApp takes a config and returns a PrivValidator and ClientCreator. -// It allows other projects to make Tendermint binaries with custom signers and applications. -type FuncSignerAndApp func(*cfg.Config) (types.PrivValidator, proxy.ClientCreator) - -// DefaultSignerAndApp is a default FuncSignerAndApp that returns a PrivValidatorFS -// and a DefaultClientCreator using the relevant fields from the config. -func DefaultSignerAndApp(config *cfg.Config) (types.PrivValidator, proxy.ClientCreator) { - privValidator := types.LoadOrGenPrivValidatorFS(config.PrivValidatorFile()) - clientCreator := proxy.DefaultClientCreator(config.ProxyApp, config.ABCI, config.DBDir()) - return privValidator, clientCreator -} - // NewRunNodeCmd returns the command that allows the CLI to start a // node. It can be used with a custom PrivValidator and in-process ABCI application. -func NewRunNodeCmd(nodeFunc nm.NodeProvider) *cobra.Command { +func NewRunNodeCmd(nodeProvider nm.NodeProvider) *cobra.Command { cmd := &cobra.Command{ Use: "node", Short: "Run the tendermint node", RunE: func(cmd *cobra.Command, args []string) error { // Create & start node - n, err := nodeFunc(config, logger) + n, err := nodeProvider(config, logger) if err != nil { return fmt.Errorf("Failed to create node: %v", err) } diff --git a/cmd/tendermint/main.go b/cmd/tendermint/main.go index d1aba6f26..86ca1531d 100644 --- a/cmd/tendermint/main.go +++ b/cmd/tendermint/main.go @@ -28,7 +28,7 @@ func main() { // * Use an external signer for their validators // * Supply an in-proc abci app // * Supply a genesis doc file from another source - // * Provide their own DB implementation + // * Provide their own DB implementation // can copy this file and use something other than the // DefaultNewNode function nodeFunc := nm.DefaultNewNode diff --git a/node/node.go b/node/node.go index 834cb4c35..4286fece2 100644 --- a/node/node.go +++ b/node/node.go @@ -113,7 +113,7 @@ type Node struct { func NewNode(config *cfg.Config, privValidator types.PrivValidator, clientCreator proxy.ClientCreator, - genDocProvider GenesisDocProvider, + genesisDocProvider GenesisDocProvider, dbProvider DBProvider, logger log.Logger) (*Node, error) { @@ -134,7 +134,7 @@ func NewNode(config *cfg.Config, } state := sm.LoadState(stateDB) if state == nil { - genDoc, err := genDocProvider() + genDoc, err := genesisDocProvider() if err != nil { return nil, err } diff --git a/types/priv_validator.go b/types/priv_validator.go index 47276f288..66f02a6f6 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -258,7 +258,7 @@ func (privVal *PrivValidatorFS) signBytesHRS(height, round int, step int8, signB } // Sign - sig, err := privVal.Signer.Sign(signBytes) + sig, err := privVal.Sign(signBytes) if err != nil { return sig, err } @@ -280,7 +280,7 @@ func (privVal *PrivValidatorFS) SignHeartbeat(chainID string, heartbeat *Heartbe privVal.mtx.Lock() defer privVal.mtx.Unlock() var err error - heartbeat.Signature, err = privVal.Signer.Sign(SignBytes(chainID, heartbeat)) + heartbeat.Signature, err = privVal.Sign(SignBytes(chainID, heartbeat)) return err }