-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #314 from cosmos/sdk2-app
New App structure
- Loading branch information
Showing
27 changed files
with
374 additions
and
268 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package app | ||
|
||
/* | ||
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 | ||
*/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package coin | ||
package types | ||
|
||
import ( | ||
"testing" | ||
|
Oops, something went wrong.