mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-30 09:12:14 +00:00
Follow-up to #1255 aligning with the expectation that the external signing process connects to the node. The SocketClient will block on start until one connection has been established, support for multiple signers connected simultaneously is a planned future extension. * SocketClient accepts connection * PrivValSocketServer renamed to RemoteSigner * extend tests
53 lines
925 B
Go
53 lines
925 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"os"
|
|
|
|
cmn "github.com/tendermint/tmlibs/common"
|
|
"github.com/tendermint/tmlibs/log"
|
|
|
|
priv_val "github.com/tendermint/tendermint/types/priv_validator"
|
|
)
|
|
|
|
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,
|
|
)
|
|
|
|
privVal := priv_val.LoadPrivValidatorJSON(*privValPath)
|
|
|
|
rs := priv_val.NewRemoteSigner(
|
|
logger,
|
|
*chainID,
|
|
*addr,
|
|
privVal,
|
|
nil,
|
|
)
|
|
err := rs.Start()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
cmn.TrapSignal(func() {
|
|
err := rs.Stop()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
})
|
|
}
|