mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-18 17:41:19 +00:00
This is a maintenance change to move the private validator package out of the types and to a top-level location. There is no good reason to keep it under the types and it will more clearly coommunicate where additions related to the privval belong. It leaves the interface and the mock in types for now as it would introduce circular dependency between privval and types, this should be resolved eventually. * mv priv_validator to privval pkg * use consistent `privval` as import Follow-up to #1255
54 lines
945 B
Go
54 lines
945 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"os"
|
|
|
|
crypto "github.com/tendermint/go-crypto"
|
|
cmn "github.com/tendermint/tmlibs/common"
|
|
"github.com/tendermint/tmlibs/log"
|
|
|
|
"github.com/tendermint/tendermint/privval"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
addr = flag.String("addr", ":46659", "Address of client to connect to")
|
|
chainID = flag.String("chain-id", "mychain", "chain id")
|
|
privValPath = flag.String("priv", "", "priv val file path")
|
|
|
|
logger = log.NewTMLogger(
|
|
log.NewSyncWriter(os.Stdout),
|
|
).With("module", "priv_val")
|
|
)
|
|
flag.Parse()
|
|
|
|
logger.Info(
|
|
"Starting private validator",
|
|
"addr", *addr,
|
|
"chainID", *chainID,
|
|
"privPath", *privValPath,
|
|
)
|
|
|
|
pv := privval.LoadFilePV(*privValPath)
|
|
|
|
rs := privval.NewRemoteSigner(
|
|
logger,
|
|
*chainID,
|
|
*addr,
|
|
pv,
|
|
crypto.GenPrivKeyEd25519(),
|
|
)
|
|
err := rs.Start()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
cmn.TrapSignal(func() {
|
|
err := rs.Stop()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
})
|
|
}
|