Set protocol versions in NodeInfo from state (#2686)

* use types.NewValidator

* node: set p2p.ProtocolVersion from state, not globals
This commit is contained in:
Ethan Buchman
2018-10-22 17:55:49 -04:00
committed by GitHub
parent f94eb42ebe
commit fe1d59ab7b
7 changed files with 24 additions and 37 deletions

View File

@ -30,17 +30,9 @@ func TestABCIValidators(t *testing.T) {
pkEd := ed25519.GenPrivKey().PubKey()
// correct validator
tmValExpected := &Validator{
Address: pkEd.Address(),
PubKey: pkEd,
VotingPower: 10,
}
tmValExpected := NewValidator(pkEd, 10)
tmVal := &Validator{
Address: pkEd.Address(),
PubKey: pkEd,
VotingPower: 10,
}
tmVal := NewValidator(pkEd, 10)
abciVal := TM2PB.ValidatorUpdate(tmVal)
tmVals, err := PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal})
@ -127,11 +119,7 @@ func TestABCIValidatorFromPubKeyAndPower(t *testing.T) {
func TestABCIValidatorWithoutPubKey(t *testing.T) {
pkEd := ed25519.GenPrivKey().PubKey()
abciVal := TM2PB.Validator(&Validator{
Address: pkEd.Address(),
PubKey: pkEd,
VotingPower: 10,
})
abciVal := TM2PB.Validator(NewValidator(pkEd, 10))
// pubkey must be nil
tmValExpected := abci.Validator{