OSDN Git Service

add node's command flag --wallet.enable
authorgguoss <1536310027@qq.com>
Wed, 11 Oct 2017 09:56:15 +0000 (17:56 +0800)
committergguoss <1536310027@qq.com>
Wed, 11 Oct 2017 09:56:15 +0000 (17:56 +0800)
cmd/bytomd/commands/run_node.go
config/config.go

index 0f1b1b6..5d41677 100644 (file)
@@ -13,7 +13,7 @@ import (
 
 var runNodeCmd = &cobra.Command{
        Use:   "node",
-       Short: "Run the p2p node",
+       Short: "Run the bytomd",
        RunE:  runNode,
 }
 
@@ -22,7 +22,8 @@ func init() {
        runNodeCmd.Flags().String("p2p.laddr", config.P2P.ListenAddress, "Node listen address. (0.0.0.0:0 means any interface, any port)")
        runNodeCmd.Flags().String("p2p.seeds", config.P2P.Seeds, "Comma delimited host:port seed nodes")
        runNodeCmd.Flags().Bool("p2p.skip_upnp", config.P2P.SkipUPNP, "Skip UPNP configuration")
-       runNodeCmd.Flags().Bool("p2p.pex", config.P2P.PexReactor, "Enable Peer-Exchange (dev feature)")
+       runNodeCmd.Flags().Bool("p2p.pex", config.P2P.PexReactor, "Enable Peer-Exchange ")
+       runNodeCmd.Flags().Bool("wallet.enable", config.Wallet.Enable, "Enable wallet")
 
        RootCmd.AddCommand(runNodeCmd)
 }
index 08c717a..3f9cbd3 100644 (file)
@@ -4,7 +4,6 @@ import (
        "fmt"
        "path/filepath"
        "time"
-       //"github.com/bytom/types"
 )
 
 type Config struct {
@@ -14,6 +13,7 @@ type Config struct {
        // Options for services
        RPC *RPCConfig `mapstructure:"rpc"`
        P2P *P2PConfig `mapstructure:"p2p"`
+       Wallet *WalletConfig `mapstructure:"wallet"`
 }
 
 func DefaultConfig() *Config {
@@ -21,6 +21,7 @@ func DefaultConfig() *Config {
                BaseConfig: DefaultBaseConfig(),
                RPC:        DefaultRPCConfig(),
                P2P:        DefaultP2PConfig(),
+               Wallet:         DefaultWalletConfig(),
        }
 }
 
@@ -29,6 +30,7 @@ func TestConfig() *Config {
                BaseConfig: TestBaseConfig(),
                RPC:        TestRPCConfig(),
                P2P:        TestP2PConfig(),
+               Wallet:         TestWalletConfig(),
        }
 }
 
@@ -205,6 +207,24 @@ func (p *P2PConfig) AddrBookFile() string {
 }
 
 //-----------------------------------------------------------------------------
+// WalletConfig
+
+type WalletConfig struct {
+       Enable  bool `mapstructure:"enable"`
+}
+
+func DefaultWalletConfig() *WalletConfig {
+       return &WalletConfig{
+               Enable: false,
+       }
+}
+
+func TestWalletConfig() *WalletConfig {
+       conf := DefaultWalletConfig()
+       return conf
+}
+
+//-----------------------------------------------------------------------------
 // Utils
 
 // helper function to make config creation independent of root dir