Updated naming of EndBlock parameters

* Changes -> Updates for validators
* ConsensusParams.XXXParams -> ConsensusParams.XXX
* As per feedback from Jae on PR
This commit is contained in:
Ethan Frey
2017-12-14 09:27:20 +01:00
parent 895e14d6bd
commit 9c5e1a824d
5 changed files with 179 additions and 176 deletions
+2 -2
View File
@@ -107,7 +107,7 @@ func TestPersistentDummyInfo(t *testing.T) {
}
// add a validator, remove a validator, update a validator
func TestValSetChanges(t *testing.T) {
func TestValSetUpdates(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil {
t.Fatal(err)
@@ -188,7 +188,7 @@ func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff [
resEndBlock := dummy.EndBlock(types.RequestEndBlock{header.Height})
dummy.Commit()
valsEqual(t, diff, resEndBlock.Changes)
valsEqual(t, diff, resEndBlock.Updates)
}
+5 -5
View File
@@ -28,7 +28,7 @@ type PersistentDummyApplication struct {
app *DummyApplication
// validator set
changes []*types.Validator
updates []*types.Validator
logger log.Logger
}
@@ -71,7 +71,7 @@ func (app *PersistentDummyApplication) DeliverTx(tx []byte) types.ResponseDelive
// format is "val:pubkey/power"
if isValidatorTx(tx) {
// update validators in the merkle tree
// and in app.changes
// and in app.updates
return app.execValidatorTx(tx)
}
@@ -119,13 +119,13 @@ func (app *PersistentDummyApplication) InitChain(req types.RequestInitChain) typ
// Track the block hash and header information
func (app *PersistentDummyApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
// reset valset changes
app.changes = make([]*types.Validator, 0)
app.updates = make([]*types.Validator, 0)
return types.ResponseBeginBlock{}
}
// Update the validator set
func (app *PersistentDummyApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
return types.ResponseEndBlock{Changes: app.changes}
return types.ResponseEndBlock{Updates: app.updates}
}
//---------------------------------------------
@@ -216,7 +216,7 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
}
// we only update the changes array if we successfully updated the tree
app.changes = append(app.changes, v)
app.updates = append(app.updates, v)
return types.ResponseDeliverTx{Code: code.CodeTypeOK}
}