Browse Source

fix chain_aware app

pull/1780/head
Ethan Buchman 8 years ago
parent
commit
0bdb3b887e
2 changed files with 7 additions and 4 deletions
  1. +3
    -3
      example/chain_aware/chain_aware_app.go
  2. +4
    -1
      example/chain_aware/chain_aware_test.go

+ 3
- 3
example/chain_aware/chain_aware_app.go View File

@ -36,8 +36,8 @@ func NewChainAwareApplication() *ChainAwareApplication {
return &ChainAwareApplication{}
}
func (app *ChainAwareApplication) Info() string {
return "nil"
func (app *ChainAwareApplication) Info() (string, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
return "nil", nil, nil, nil
}
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)), "")
}
func (app *ChainAwareApplication) BeginBlock(height uint64) {
func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) {
app.beginCount += 1
return
}


+ 4
- 1
example/chain_aware/chain_aware_test.go View File

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


Loading…
Cancel
Save