package baseapp /* XXX Make this work with MultiStore. XXX It will require some interfaces updates in store/types.go. if len(reqQuery.Data) == 0 { resQuery.Log = "Query cannot be zero length" resQuery.Code = abci.CodeType_EncodingError return } // set the query response height to current tree := app.state.Committed() height := reqQuery.Height if height == 0 { // TODO: once the rpc actually passes in non-zero // heights we can use to query right after a tx // we must retrun most recent, even if apphash // is not yet in the blockchain withProof := app.CommittedHeight() - 1 if tree.Tree.VersionExists(withProof) { height = withProof } else { height = app.CommittedHeight() } } resQuery.Height = height switch reqQuery.Path { case "/store", "/key": // Get by key key := reqQuery.Data // Data holds the key bytes resQuery.Key = key if reqQuery.Prove { value, proof, err := tree.GetVersionedWithProof(key, height) if err != nil { resQuery.Log = err.Error() break } resQuery.Value = value resQuery.Proof = proof.Bytes() } else { value := tree.Get(key) resQuery.Value = value } default: resQuery.Code = abci.CodeType_UnknownRequest resQuery.Log = cmn.Fmt("Unexpected Query path: %v", reqQuery.Path) } return */