mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-20 08:26:31 +00:00
Integrate privVal client with node secret
This commit is contained in:
committed by
Ethan Buchman
parent
38d18ca11a
commit
7d71e702d8
@ -13,6 +13,7 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
chainID = flag.String("chain-id", "mychain", "chain id")
|
chainID = flag.String("chain-id", "mychain", "chain id")
|
||||||
|
numClients = flag.Int("clients", 1, "number of concurrently connected clients")
|
||||||
privValPath = flag.String("priv", "", "priv val file path")
|
privValPath = flag.String("priv", "", "priv val file path")
|
||||||
socketAddr = flag.String("socket.addr", ":46659", "socket bind addr")
|
socketAddr = flag.String("socket.addr", ":46659", "socket bind addr")
|
||||||
|
|
||||||
@ -20,17 +21,19 @@ func main() {
|
|||||||
)
|
)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
logger.Info("args", "chainID", *chainID, "privPath", *privValPath)
|
logger.Info("Reading args privValidatorSocketServer", "chainID", *chainID, "privPath", *privValPath)
|
||||||
|
|
||||||
privVal := priv_val.LoadPrivValidatorJSON(*privValPath)
|
privVal := priv_val.LoadPrivValidatorJSON(*privValPath)
|
||||||
|
|
||||||
pvss := priv_val.NewPrivValidatorSocketServer(
|
pvss := priv_val.NewPrivValidatorSocketServer(
|
||||||
logger,
|
logger,
|
||||||
*socketAddr,
|
|
||||||
*chainID,
|
*chainID,
|
||||||
|
*socketAddr,
|
||||||
|
*numClients,
|
||||||
privVal,
|
privVal,
|
||||||
|
nil,
|
||||||
)
|
)
|
||||||
// pvss.Start()
|
pvss.Start()
|
||||||
|
|
||||||
cmn.TrapSignal(func() {
|
cmn.TrapSignal(func() {
|
||||||
pvss.Stop()
|
pvss.Stop()
|
||||||
|
32
node/node.go
32
node/node.go
@ -79,13 +79,13 @@ type NodeProvider func(*cfg.Config, log.Logger) (*Node, error)
|
|||||||
func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) {
|
func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) {
|
||||||
var privVal types.PrivValidator
|
var privVal types.PrivValidator
|
||||||
privVal = types.LoadOrGenPrivValidatorFS(config.PrivValidatorFile())
|
privVal = types.LoadOrGenPrivValidatorFS(config.PrivValidatorFile())
|
||||||
/*
|
/* TODO
|
||||||
if config.PrivValidatorAddr != "" {
|
if config.PrivValidatorAddr != "" {
|
||||||
pvsc := priv_val.NewPrivValidatorSocketClient(logger.With("module", "priv_val"),
|
pvsc := priv_val.NewPrivValidatorSocketClient(logger.With("module", "priv_val"),
|
||||||
config.PrivValidatorAddr)
|
config.PrivValidatorAddr)
|
||||||
pvsc.Start()
|
pvsc.Start()
|
||||||
privVal = pvsc
|
privVal = pvsc
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
fmt.Println("PRIV", config.PrivValidatorAddr)
|
fmt.Println("PRIV", config.PrivValidatorAddr)
|
||||||
|
|
||||||
@ -94,7 +94,8 @@ func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) {
|
|||||||
proxy.DefaultClientCreator(config.ProxyApp, config.ABCI, config.DBDir()),
|
proxy.DefaultClientCreator(config.ProxyApp, config.ABCI, config.DBDir()),
|
||||||
DefaultGenesisDocProviderFunc(config),
|
DefaultGenesisDocProviderFunc(config),
|
||||||
DefaultDBProvider,
|
DefaultDBProvider,
|
||||||
logger)
|
logger,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -183,6 +184,21 @@ func NewNode(config *cfg.Config,
|
|||||||
// reload the state (it may have been updated by the handshake)
|
// reload the state (it may have been updated by the handshake)
|
||||||
state = sm.LoadState(stateDB)
|
state = sm.LoadState(stateDB)
|
||||||
|
|
||||||
|
/* TODO
|
||||||
|
// Generate node PrivKey
|
||||||
|
privKey := crypto.GenPrivKeyEd25519()
|
||||||
|
|
||||||
|
if config.PrivValidatorAddr != "" {
|
||||||
|
pvsc := priv_val.NewPrivValidatorSocketClient(
|
||||||
|
logger.With("module", "priv_val"),
|
||||||
|
config.PrivValidatorAddr,
|
||||||
|
&privKey,
|
||||||
|
)
|
||||||
|
pvsc.Start()
|
||||||
|
privValidator = pvsc
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Decide whether to fast-sync or not
|
// Decide whether to fast-sync or not
|
||||||
// We don't fast-sync when the only validator is us.
|
// We don't fast-sync when the only validator is us.
|
||||||
fastSync := config.FastSync
|
fastSync := config.FastSync
|
||||||
|
Reference in New Issue
Block a user