From dde413d44bb0a3b718dda3c6918949243da008af Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 10 Jan 2017 19:14:35 +0100 Subject: [PATCH] Cleaned up text --- README.md | 3 ++- example/dummy/dummy.go | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3a9b27cb1..23c1ac656 100644 --- a/README.md +++ b/README.md @@ -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__:
- 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.
+ *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__:
diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index fcf067dc2..39f54fc28 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -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") }