mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-26 19:21:44 +00:00
Add Query; Add benchmark tests
This commit is contained in:
@ -29,7 +29,7 @@ func (app *CounterApplication) SetOption(key string, value string) types.RetCode
|
||||
if key == "serial" && value == "on" {
|
||||
app.serial = true
|
||||
}
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *CounterApplication) AppendTx(tx []byte) ([]types.Event, types.RetCode) {
|
||||
@ -42,7 +42,7 @@ func (app *CounterApplication) AppendTx(tx []byte) ([]types.Event, types.RetCode
|
||||
}
|
||||
}
|
||||
app.txCount += 1
|
||||
return nil, 0
|
||||
return nil, types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *CounterApplication) CheckTx(tx []byte) types.RetCode {
|
||||
@ -54,25 +54,29 @@ func (app *CounterApplication) CheckTx(tx []byte) types.RetCode {
|
||||
return types.RetCodeBadNonce
|
||||
}
|
||||
}
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *CounterApplication) GetHash() ([]byte, types.RetCode) {
|
||||
app.hashCount += 1
|
||||
|
||||
if app.txCount == 0 {
|
||||
return nil, 0
|
||||
return nil, types.RetCodeOK
|
||||
} else {
|
||||
hash := make([]byte, 32)
|
||||
binary.LittleEndian.PutUint64(hash, uint64(app.txCount))
|
||||
return hash, 0
|
||||
return hash, types.RetCodeOK
|
||||
}
|
||||
}
|
||||
|
||||
func (app *CounterApplication) AddListener(key string) types.RetCode {
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *CounterApplication) RemListener(key string) types.RetCode {
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *CounterApplication) Query(query []byte) (types.RetCode, []byte) {
|
||||
return types.RetCodeOK, nil
|
||||
}
|
||||
|
@ -27,27 +27,31 @@ func (app *DummyApplication) Info() []string {
|
||||
}
|
||||
|
||||
func (app *DummyApplication) SetOption(key string, value string) types.RetCode {
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *DummyApplication) AppendTx(tx []byte) ([]types.Event, types.RetCode) {
|
||||
app.state.Set(tx, tx)
|
||||
return nil, 0
|
||||
return nil, types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *DummyApplication) CheckTx(tx []byte) types.RetCode {
|
||||
return 0 // all txs are valid
|
||||
return types.RetCodeOK // all txs are valid
|
||||
}
|
||||
|
||||
func (app *DummyApplication) GetHash() ([]byte, types.RetCode) {
|
||||
hash := app.state.Hash()
|
||||
return hash, 0
|
||||
return hash, types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *DummyApplication) AddListener(key string) types.RetCode {
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *DummyApplication) RemListener(key string) types.RetCode {
|
||||
return 0
|
||||
return types.RetCodeOK
|
||||
}
|
||||
|
||||
func (app *DummyApplication) Query(query []byte) (types.RetCode, []byte) {
|
||||
return types.RetCodeOK, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user