mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-28 08:12:23 +00:00
Cleaned up text
This commit is contained in:
parent
732274b7f6
commit
dde413d44b
@ -100,7 +100,8 @@ ABCI requests/responses are simple Protobuf messages. Check out the [schema fil
|
|||||||
* `Data ([]byte)`: The query response bytes
|
* `Data ([]byte)`: The query response bytes
|
||||||
* `Log (string)`: Debug or error message
|
* `Log (string)`: Debug or error message
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
Return a Merkle proof from the key/value pair back to the application hash.
|
Return a Merkle proof from the key/value pair back to the application hash.<br/>
|
||||||
|
*Please note* The current implementation of go-merkle doesn't support querying proofs from past blocks, so for the present moment, any height other than 0 will return an error. Hopefully this will be improved soon(ish)
|
||||||
|
|
||||||
#### Flush
|
#### Flush
|
||||||
* __Usage__:<br/>
|
* __Usage__:<br/>
|
||||||
|
@ -2,7 +2,6 @@ package dummy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/tendermint/abci/types"
|
"github.com/tendermint/abci/types"
|
||||||
@ -50,18 +49,21 @@ func (app *DummyApplication) Commit() types.Result {
|
|||||||
|
|
||||||
func (app *DummyApplication) Query(query []byte) types.Result {
|
func (app *DummyApplication) Query(query []byte) types.Result {
|
||||||
index, value, exists := app.state.Get(query)
|
index, value, exists := app.state.Get(query)
|
||||||
|
|
||||||
queryResult := QueryResult{index, string(value), hex.EncodeToString(value), exists}
|
queryResult := QueryResult{index, string(value), hex.EncodeToString(value), exists}
|
||||||
return types.NewResultOK(wire.JSONBytes(queryResult), "")
|
return types.NewResultOK(wire.JSONBytes(queryResult), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *DummyApplication) Proof(key []byte, blockHeight int64) types.Result {
|
func (app *DummyApplication) Proof(key []byte, blockHeight int64) types.Result {
|
||||||
|
// TODO: when go-merkle supports querying older blocks without possible panics,
|
||||||
|
// we should store a cache and allow a query. But for now it is impossible.
|
||||||
|
// And this is just a Dummy application anyway, what do you expect? ;)
|
||||||
if blockHeight != 0 {
|
if blockHeight != 0 {
|
||||||
return types.ErrUnknownRequest
|
return types.ErrUnknownRequest
|
||||||
}
|
}
|
||||||
proof, exists := app.state.Proof(key)
|
proof, exists := app.state.Proof(key)
|
||||||
if !exists {
|
if !exists {
|
||||||
fmt.Println("Didn't find nothing")
|
return types.NewResultOK(nil, Fmt("Cannot find key = %v", key))
|
||||||
return types.NewResultOK(nil, "")
|
|
||||||
}
|
}
|
||||||
return types.NewResultOK(proof, "Found the key")
|
return types.NewResultOK(proof, "Found the key")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user