diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index 70af588a..6faea3f0 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -419,7 +419,7 @@ func waitForAndValidateBlock(t *testing.T, n int, activeVals map[string]struct{} err := validateBlock(newBlock, activeVals) assert.Nil(t, err) for _, tx := range txs { - css[j].mempool.CheckTx(tx, nil) + err := css[j].mempool.CheckTx(tx, nil) assert.Nil(t, err) } }, css) diff --git a/consensus/replay.go b/consensus/replay.go index 75173061..8ecf88b8 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -266,13 +266,13 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight // If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain. if appBlockHeight == 0 { - nvals := types.TM2PB.Validators(state.Validators) // state.Validators would work too. + nextVals := types.TM2PB.Validators(state.Validators) // state.Validators would work too. csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams) req := abci.RequestInitChain{ Time: h.genDoc.GenesisTime.Unix(), // TODO ChainId: h.genDoc.ChainID, ConsensusParams: csParams, - Validators: nvals, + Validators: nextVals, AppStateBytes: h.genDoc.AppStateJSON, } res, err := proxyApp.Consensus().InitChainSync(req) diff --git a/lite/client/provider.go b/lite/client/provider.go index 188ce7d0..1612ddd7 100644 --- a/lite/client/provider.go +++ b/lite/client/provider.go @@ -53,7 +53,7 @@ func (p *provider) LatestFullCommit(chainID string, minHeight, maxHeight int64) return } if maxHeight != 0 && maxHeight < minHeight { - err = fmt.Errorf("need maxHeight == 0 or minHeight <= maxHeight, got %v and %v", + err = fmt.Errorf("need maxHeight == 0 or minHeight <= maxHeight, got min %v and max %v", minHeight, maxHeight) return } @@ -95,7 +95,7 @@ func (p *provider) getValidatorSet(chainID string, height int64) (valset *types. return } if height < 1 { - err = fmt.Errorf("expected height >= 1, got %v", height) + err = fmt.Errorf("expected height >= 1, got height %v", height) return } heightPtr := new(int64) @@ -122,11 +122,11 @@ func (p *provider) fillFullCommit(signedHeader types.SignedHeader) (fc lite.Full fc.Validators = valset // Get the next validators. - nvalset, err := p.getValidatorSet(signedHeader.ChainID, signedHeader.Height+1) + nextValset, err := p.getValidatorSet(signedHeader.ChainID, signedHeader.Height+1) if err != nil { return lite.FullCommit{}, err } else { - fc.NextValidators = nvalset + fc.NextValidators = nextValset } return fc, nil diff --git a/lite/commit.go b/lite/commit.go index 8449bf69..e62bd166 100644 --- a/lite/commit.go +++ b/lite/commit.go @@ -20,11 +20,11 @@ type FullCommit struct { } // NewFullCommit returns a new FullCommit. -func NewFullCommit(signedHeader types.SignedHeader, valset, nvalset *types.ValidatorSet) FullCommit { +func NewFullCommit(signedHeader types.SignedHeader, valset, nextValset *types.ValidatorSet) FullCommit { return FullCommit{ SignedHeader: signedHeader, Validators: valset, - NextValidators: nvalset, + NextValidators: nextValset, } } diff --git a/lite/dbprovider.go b/lite/dbprovider.go index 834bab66..149a0ed3 100644 --- a/lite/dbprovider.go +++ b/lite/dbprovider.go @@ -148,14 +148,14 @@ func (dbp *DBProvider) getValidatorSet(chainID string, height int64) (valset *ty func (dbp *DBProvider) fillFullCommit(sh types.SignedHeader) (FullCommit, error) { var chainID = sh.ChainID var height = sh.Height - var valset, nvalset *types.ValidatorSet + var valset, nextValset *types.ValidatorSet // Load the validator set. valset, err := dbp.getValidatorSet(chainID, height) if err != nil { return FullCommit{}, err } // Load the next validator set. - nvalset, err = dbp.getValidatorSet(chainID, height+1) + nextValset, err = dbp.getValidatorSet(chainID, height+1) if err != nil { return FullCommit{}, err } @@ -163,6 +163,6 @@ func (dbp *DBProvider) fillFullCommit(sh types.SignedHeader) (FullCommit, error) return FullCommit{ SignedHeader: sh, Validators: valset, - NextValidators: nvalset, + NextValidators: nextValset, }, nil } diff --git a/lite/helpers.go b/lite/helpers.go index 764df507..de02b739 100644 --- a/lite/helpers.go +++ b/lite/helpers.go @@ -96,7 +96,7 @@ func makeVote(header *types.Header, valset *types.ValidatorSet, key crypto.PrivK } func genHeader(chainID string, height int64, txs types.Txs, - valset, nvalset *types.ValidatorSet, appHash, consHash, resHash []byte) *types.Header { + valset, nextValset *types.ValidatorSet, appHash, consHash, resHash []byte) *types.Header { return &types.Header{ ChainID: chainID, @@ -107,7 +107,7 @@ func genHeader(chainID string, height int64, txs types.Txs, // LastBlockID // LastCommitHash ValidatorsHash: valset.Hash(), - NextValidatorsHash: nvalset.Hash(), + NextValidatorsHash: nextValset.Hash(), DataHash: txs.Hash(), AppHash: appHash, ConsensusHash: consHash, @@ -117,9 +117,9 @@ func genHeader(chainID string, height int64, txs types.Txs, // GenSignedHeader calls genHeader and signHeader and combines them into a SignedHeader. func (pkz privKeys) GenSignedHeader(chainID string, height int64, txs types.Txs, - valset, nvalset *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) types.SignedHeader { + valset, nextValset *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) types.SignedHeader { - header := genHeader(chainID, height, txs, valset, nvalset, appHash, consHash, resHash) + header := genHeader(chainID, height, txs, valset, nextValset, appHash, consHash, resHash) check := types.SignedHeader{ Header: header, Commit: pkz.signHeader(header, first, last), @@ -129,12 +129,12 @@ func (pkz privKeys) GenSignedHeader(chainID string, height int64, txs types.Txs, // GenFullCommit calls genHeader and signHeader and combines them into a FullCommit. func (pkz privKeys) GenFullCommit(chainID string, height int64, txs types.Txs, - valset, nvalset *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) FullCommit { + valset, nextValset *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) FullCommit { - header := genHeader(chainID, height, txs, valset, nvalset, appHash, consHash, resHash) + header := genHeader(chainID, height, txs, valset, nextValset, appHash, consHash, resHash) commit := types.SignedHeader{ Header: header, Commit: pkz.signHeader(header, first, last), } - return NewFullCommit(commit, valset, nvalset) + return NewFullCommit(commit, valset, nextValset) } diff --git a/lite/inquiring_certifier.go b/lite/inquiring_certifier.go index 049cd728..3e61b958 100644 --- a/lite/inquiring_certifier.go +++ b/lite/inquiring_certifier.go @@ -95,7 +95,7 @@ func (ic *InquiringCertifier) Certify(shdr types.SignedHeader) error { } // Get the next validator set. - nvalset, err := ic.source.ValidatorSet(ic.chainID, shdr.Height+1) + nextValset, err := ic.source.ValidatorSet(ic.chainID, shdr.Height+1) if lerr.IsErrMissingValidators(err) { // Ignore this error. return nil @@ -106,7 +106,7 @@ func (ic *InquiringCertifier) Certify(shdr types.SignedHeader) error { nfc := FullCommit{ SignedHeader: shdr, Validators: tfc.NextValidators, - NextValidators: nvalset, + NextValidators: nextValset, } // Validate the full commit. This checks the cryptographic // signatures of Commit against Validators. diff --git a/lite/inquiring_certifier_test.go b/lite/inquiring_certifier_test.go index b3d8edea..8da5a7c1 100644 --- a/lite/inquiring_certifier_test.go +++ b/lite/inquiring_certifier_test.go @@ -28,12 +28,12 @@ func TestInquirerValidPath(t *testing.T) { fcz := make([]FullCommit, count) for i := 0; i < count; i++ { vals := keys.ToValidators(vote, 0) - nvals := nkeys.ToValidators(vote, 0) + nextVals := nkeys.ToValidators(vote, 0) h := int64(1 + i) appHash := []byte(fmt.Sprintf("h=%d", h)) fcz[i] = keys.GenFullCommit( chainID, h, nil, - vals, nvals, + vals, nextVals, appHash, consHash, resHash, 0, len(keys)) // Extend the keys by 1 each time. keys = nkeys @@ -85,13 +85,13 @@ func TestInquirerVerifyHistorical(t *testing.T) { fcz := make([]FullCommit, count) for i := 0; i < count; i++ { vals := keys.ToValidators(vote, 0) - nvals := nkeys.ToValidators(vote, 0) + nextVals := nkeys.ToValidators(vote, 0) h := int64(1 + i) appHash := []byte(fmt.Sprintf("h=%d", h)) resHash := []byte(fmt.Sprintf("res=%d", h)) fcz[i] = keys.GenFullCommit( chainID, h, nil, - vals, nvals, + vals, nextVals, appHash, consHash, resHash, 0, len(keys)) // Extend the keys by 1 each time. keys = nkeys