mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-05 23:57:04 +00:00
EndBlock also returns ResponseEndBlock
This commit is contained in:
@@ -15,7 +15,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
// Start the listener
|
||||
_, err := server.NewServer(*addrPtr, *tmspPtr, NewChainAwareApplication())
|
||||
srv, err := server.NewServer(*addrPtr, *tmspPtr, NewChainAwareApplication())
|
||||
if err != nil {
|
||||
Exit(err.Error())
|
||||
}
|
||||
@@ -23,6 +23,7 @@ func main() {
|
||||
// Wait forever
|
||||
TrapSignal(func() {
|
||||
// Cleanup
|
||||
srv.Stop()
|
||||
})
|
||||
|
||||
}
|
||||
@@ -65,9 +66,9 @@ func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header)
|
||||
return
|
||||
}
|
||||
|
||||
func (app *ChainAwareApplication) EndBlock(height uint64) []*types.Validator {
|
||||
func (app *ChainAwareApplication) EndBlock(height uint64) (resEndBlock types.ResponseEndBlock) {
|
||||
app.endCount += 1
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
func (app *ChainAwareApplication) InitChain(vals []*types.Validator) {
|
||||
|
||||
@@ -16,10 +16,11 @@ func TestChainAware(t *testing.T) {
|
||||
app := NewChainAwareApplication()
|
||||
|
||||
// Start the listener
|
||||
_, err := server.NewServer("unix://test.sock", "socket", app)
|
||||
srv, err := server.NewServer("unix://test.sock", "socket", app)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer srv.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
|
||||
|
||||
@@ -179,10 +179,10 @@ func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff [
|
||||
t.Fatal(r)
|
||||
}
|
||||
}
|
||||
diff2 := dummyChain.EndBlock(height)
|
||||
resEndBlock := dummyChain.EndBlock(height)
|
||||
dummy.Commit()
|
||||
|
||||
valsEqual(t, diff, diff2)
|
||||
valsEqual(t, diff, resEndBlock.Diffs)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@ func (app *PersistentDummyApplication) BeginBlock(hash []byte, header *types.Hea
|
||||
}
|
||||
|
||||
// Update the validator set
|
||||
func (app *PersistentDummyApplication) EndBlock(height uint64) (diffs []*types.Validator) {
|
||||
return app.changes
|
||||
func (app *PersistentDummyApplication) EndBlock(height uint64) (resEndBlock types.ResponseEndBlock) {
|
||||
return types.ResponseEndBlock{Diffs: app.changes}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user