diff --git a/cmd/tendermint/commands/show_validator.go b/cmd/tendermint/commands/show_validator.go index ad12dbb11..8210aedfd 100644 --- a/cmd/tendermint/commands/show_validator.go +++ b/cmd/tendermint/commands/show_validator.go @@ -19,7 +19,6 @@ func showValidator(cmd *cobra.Command, args []string) { // TODO(ismail): add a flag and check if we actually want to see the pub key // of the remote signer instead of the FilePV privValidator := privval.LoadOrGenFilePV(config.PrivValidatorFile()) - key := privValidator.GetPubKey() - pubKeyJSONBytes, _ := cdc.MarshalJSON(key) + pubKeyJSONBytes, _ := cdc.MarshalJSON(privValidator.GetPubKey()) fmt.Println(string(pubKeyJSONBytes)) } diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index a35a3d9ff..5334895f4 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -281,9 +281,7 @@ func TestReactorVotingPowerChange(t *testing.T) { //--------------------------------------------------------------------------- logger.Debug("---------------------------- Testing changing the voting power of one validator a few times") - pubKey := css[0].privValidator.GetPubKey() - - val1PubKey := pubKey + val1PubKey := css[0].privValidator.GetPubKey() val1PubKeyABCI := types.TM2PB.PubKey(val1PubKey) updateValidatorTx := kvstore.MakeValSetChangeTx(val1PubKeyABCI, 25) previousTotalVotingPower := css[0].GetRoundState().LastValidators.TotalVotingPower() @@ -347,8 +345,7 @@ func TestReactorValidatorSetChanges(t *testing.T) { //--------------------------------------------------------------------------- logger.Info("---------------------------- Testing adding one validator") - pubKey := css[nVals].privValidator.GetPubKey() - newValidatorPubKey1 := pubKey + newValidatorPubKey1 := css[nVals].privValidator.GetPubKey() valPubKey1ABCI := types.TM2PB.PubKey(newValidatorPubKey1) newValidatorTx1 := kvstore.MakeValSetChangeTx(valPubKey1ABCI, testMinPower) @@ -375,8 +372,7 @@ func TestReactorValidatorSetChanges(t *testing.T) { //--------------------------------------------------------------------------- logger.Info("---------------------------- Testing changing the voting power of one validator") - pubKey = css[nVals].privValidator.GetPubKey() - updateValidatorPubKey1 := pubKey + updateValidatorPubKey1 := css[nVals].privValidator.GetPubKey() updatePubKey1ABCI := types.TM2PB.PubKey(updateValidatorPubKey1) updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25) previousTotalVotingPower := css[nVals].GetRoundState().LastValidators.TotalVotingPower() @@ -393,13 +389,11 @@ func TestReactorValidatorSetChanges(t *testing.T) { //--------------------------------------------------------------------------- logger.Info("---------------------------- Testing adding two validators at once") - pubKey = css[nVals+1].privValidator.GetPubKey() - newValidatorPubKey2 := pubKey + newValidatorPubKey2 := css[nVals+1].privValidator.GetPubKey() newVal2ABCI := types.TM2PB.PubKey(newValidatorPubKey2) newValidatorTx2 := kvstore.MakeValSetChangeTx(newVal2ABCI, testMinPower) - pubKey = css[nVals+2].privValidator.GetPubKey() - newValidatorPubKey3 := pubKey + newValidatorPubKey3 := css[nVals+2].privValidator.GetPubKey() newVal3ABCI := types.TM2PB.PubKey(newValidatorPubKey3) newValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, testMinPower) diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 540e4a58c..5d42bdc8e 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -332,7 +332,6 @@ func testHandshakeReplay(t *testing.T, nBlocks int, mode uint) { require.NoError(t, err) pubKey := privVal.GetPubKey() - require.NoError(t, err) stateDB, state, store := stateAndStore(config, pubKey, kvstore.ProtocolVersion) store.chain = chain store.commits = commits diff --git a/consensus/state.go b/consensus/state.go index 30122b7d8..1693e36b5 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1678,8 +1678,7 @@ func (cs *ConsensusState) voteTime() time.Time { // sign the vote and publish on internalMsgQueue func (cs *ConsensusState) signAddVote(type_ types.SignedMsgType, hash []byte, header types.PartSetHeader) *types.Vote { // if we don't have a key or we're not in the validator set, do nothing - privValAddr := cs.privValidator.GetPubKey().Address() - if cs.privValidator == nil || !cs.Validators.HasAddress(privValAddr) { + if cs.privValidator == nil || !cs.Validators.HasAddress(cs.privValidator.GetPubKey().Address()) { return nil } vote, err := cs.signVote(type_, hash, header)