use request struct for Info

This commit is contained in:
Ethan Buchman
2017-09-22 11:10:55 -04:00
parent 3d1fd4cefa
commit 667c2543ea
15 changed files with 152 additions and 202 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ func NewCounterApplication(serial bool) *CounterApplication {
return &CounterApplication{serial: serial}
}
func (app *CounterApplication) Info() types.ResponseInfo {
func (app *CounterApplication) Info(req types.RequestInfo) types.ResponseInfo {
return types.ResponseInfo{Data: cmn.Fmt("{\"hashes\":%v,\"txs\":%v}", app.hashCount, app.txCount)}
}
+1 -1
View File
@@ -20,7 +20,7 @@ func NewDummyApplication() *DummyApplication {
return &DummyApplication{state: state}
}
func (app *DummyApplication) Info() (resInfo types.ResponseInfo) {
func (app *DummyApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
return types.ResponseInfo{Data: cmn.Fmt("{\"size\":%v}", app.state.Size())}
}
+2 -2
View File
@@ -80,7 +80,7 @@ func TestPersistentDummyInfo(t *testing.T) {
dummy := NewPersistentDummyApplication(dir)
height := uint64(0)
resInfo := dummy.Info()
resInfo := dummy.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight)
}
@@ -95,7 +95,7 @@ func TestPersistentDummyInfo(t *testing.T) {
dummy.EndBlock(height)
dummy.Commit()
resInfo = dummy.Info()
resInfo = dummy.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight)
}
+2 -2
View File
@@ -55,8 +55,8 @@ func (app *PersistentDummyApplication) SetLogger(l log.Logger) {
app.logger = l
}
func (app *PersistentDummyApplication) Info() (resInfo types.ResponseInfo) {
resInfo = app.app.Info()
func (app *PersistentDummyApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
resInfo = app.app.Info(req)
lastBlock := LoadLastBlock(app.db)
resInfo.LastBlockHeight = lastBlock.Height
resInfo.LastBlockAppHash = lastBlock.AppHash