mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-04 15:17:02 +00:00
use request struct for Info
This commit is contained in:
@@ -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)}
|
||||
}
|
||||
|
||||
|
||||
@@ -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())}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user