fix chain_aware app

This commit is contained in:
Ethan Buchman 2016-11-16 16:22:52 -05:00
parent 60e0842ef9
commit 0bdb3b887e
2 changed files with 7 additions and 4 deletions

View File

@ -36,8 +36,8 @@ func NewChainAwareApplication() *ChainAwareApplication {
return &ChainAwareApplication{} return &ChainAwareApplication{}
} }
func (app *ChainAwareApplication) Info() string { func (app *ChainAwareApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
return "nil" return "nil", nil, nil, nil
} }
func (app *ChainAwareApplication) SetOption(key string, value string) (log string) { func (app *ChainAwareApplication) SetOption(key string, value string) (log string) {
@ -60,7 +60,7 @@ func (app *ChainAwareApplication) Query(query []byte) types.Result {
return types.NewResultOK([]byte(Fmt("%d,%d", app.beginCount, app.endCount)), "") return types.NewResultOK([]byte(Fmt("%d,%d", app.beginCount, app.endCount)), "")
} }
func (app *ChainAwareApplication) BeginBlock(height uint64) { func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) {
app.beginCount += 1 app.beginCount += 1
return return
} }

View File

@ -8,6 +8,7 @@ import (
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/client" "github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/server" "github.com/tendermint/tmsp/server"
"github.com/tendermint/tmsp/types"
) )
func TestChainAware(t *testing.T) { func TestChainAware(t *testing.T) {
@ -29,8 +30,10 @@ func TestChainAware(t *testing.T) {
defer client.Stop() defer client.Stop()
n := uint64(5) n := uint64(5)
hash := []byte("fake block hash")
header := &types.Header{}
for i := uint64(0); i < n; i++ { for i := uint64(0); i < n; i++ {
client.BeginBlockSync(i) client.BeginBlockSync(hash, header)
client.EndBlockSync(i) client.EndBlockSync(i)
client.CommitSync() client.CommitSync()
} }