Browse Source

Cleaned up text

pull/1780/head
Ethan Frey 8 years ago
parent
commit
dde413d44b
2 changed files with 7 additions and 4 deletions
  1. +2
    -1
      README.md
  2. +5
    -3
      example/dummy/dummy.go

+ 2
- 1
README.md View File

@ -100,7 +100,8 @@ ABCI requests/responses are simple Protobuf messages. Check out the [schema fil
* `Data ([]byte)`: The query response bytes
* `Log (string)`: Debug or error message
* __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
* __Usage__:<br/>


+ 5
- 3
example/dummy/dummy.go View File

@ -2,7 +2,6 @@ package dummy
import (
"encoding/hex"
"fmt"
"strings"
"github.com/tendermint/abci/types"
@ -50,18 +49,21 @@ func (app *DummyApplication) Commit() types.Result {
func (app *DummyApplication) Query(query []byte) types.Result {
index, value, exists := app.state.Get(query)
queryResult := QueryResult{index, string(value), hex.EncodeToString(value), exists}
return types.NewResultOK(wire.JSONBytes(queryResult), "")
}
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 {
return types.ErrUnknownRequest
}
proof, exists := app.state.Proof(key)
if !exists {
fmt.Println("Didn't find nothing")
return types.NewResultOK(nil, "")
return types.NewResultOK(nil, Fmt("Cannot find key = %v", key))
}
return types.NewResultOK(proof, "Found the key")
}


Loading…
Cancel
Save