From 4334135651510b8586380cf86130143c2bbd5ec3 Mon Sep 17 00:00:00 2001 From: JayT106 Date: Mon, 5 Jul 2021 01:42:29 -0400 Subject: [PATCH] privval: missing privval type check in SetPrivValidator (#6645) --- internal/consensus/state.go | 5 ++++- types/priv_validator.go | 11 ++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index eece8d7ca..a20f488e4 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -25,6 +25,7 @@ import ( "github.com/tendermint/tendermint/libs/service" tmtime "github.com/tendermint/tendermint/libs/time" "github.com/tendermint/tendermint/privval" + tmgrpc "github.com/tendermint/tendermint/privval/grpc" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" sm "github.com/tendermint/tendermint/state" "github.com/tendermint/tendermint/types" @@ -281,7 +282,9 @@ func (cs *State) SetPrivValidator(priv types.PrivValidator) { case *privval.FilePV: cs.privValidatorType = types.FileSignerClient case *privval.SignerClient: - cs.privValidatorType = types.SignerClient + cs.privValidatorType = types.SignerSocketClient + case *tmgrpc.SignerClient: + cs.privValidatorType = types.SignerGRPCClient case types.MockPV: cs.privValidatorType = types.MockSignerClient case *types.ErroringMockPV: diff --git a/types/priv_validator.go b/types/priv_validator.go index 9b10559dc..aa2c303db 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -15,11 +15,12 @@ import ( type PrivValidatorType uint8 const ( - MockSignerClient = PrivValidatorType(0x00) // mock singer - FileSignerClient = PrivValidatorType(0x01) // singer client via file - RetrySignerClient = PrivValidatorType(0x02) // singer client via socket - SignerClient = PrivValidatorType(0x03) // singer client via gRPC - ErrorMockSignerClient = PrivValidatorType(0x04) // error mock singer + MockSignerClient = PrivValidatorType(0x00) // mock signer + FileSignerClient = PrivValidatorType(0x01) // signer client via file + RetrySignerClient = PrivValidatorType(0x02) // signer client with retry via socket + SignerSocketClient = PrivValidatorType(0x03) // signer client via socket + ErrorMockSignerClient = PrivValidatorType(0x04) // error mock signer + SignerGRPCClient = PrivValidatorType(0x05) // signer client via gRPC ) // PrivValidator defines the functionality of a local Tendermint validator