Begin adding proof calls

This commit is contained in:
Ethan Frey
2017-01-17 15:42:54 +01:00
parent 98c4679f39
commit 58ea995032
14 changed files with 131 additions and 2 deletions
+4
View File
@@ -61,6 +61,10 @@ func (app *ChainAwareApplication) Query(query []byte) types.Result {
return types.NewResultOK([]byte(Fmt("%d,%d", app.beginCount, app.endCount)), "")
}
func (app *ChainAwareApplication) Proof(key []byte) types.Result {
return types.NewResultOK(nil, Fmt("Proof is not supported"))
}
func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) {
app.beginCount += 1
return
+4
View File
@@ -83,3 +83,7 @@ func (app *CounterApplication) Query(query []byte) types.Result {
return types.ErrUnknownRequest.SetLog(Fmt("Invalid nonce. Expected hash or tx, got %v", queryStr))
}
func (app *CounterApplication) Proof(key []byte) types.Result {
return types.NewResultOK(nil, Fmt("Proof is not supported"))
}
+4
View File
@@ -53,6 +53,10 @@ func (app *DummyApplication) Query(query []byte) types.Result {
return types.NewResultOK(wire.JSONBytes(queryResult), "")
}
func (app *DummyApplication) Proof(key []byte) types.Result {
return types.NewResultOK(nil, Fmt("TODO: support proof!"))
}
type QueryResult struct {
Index int `json:"index"`
Value string `json:"value"`
+4
View File
@@ -93,6 +93,10 @@ func (app *PersistentDummyApplication) Query(query []byte) types.Result {
return app.app.Query(query)
}
func (app *PersistentDummyApplication) Proof(key []byte) types.Result {
return types.NewResultOK(nil, Fmt("TODO: support proof!"))
}
// Save the validators in the merkle tree
func (app *PersistentDummyApplication) InitChain(validators []*types.Validator) {
for _, v := range validators {
+4
View File
@@ -34,3 +34,7 @@ func (app *NilApplication) Commit() types.Result {
func (app *NilApplication) Query(query []byte) types.Result {
return types.NewResultOK(nil, "")
}
func (app *NilApplication) Proof(key []byte) types.Result {
return types.NewResultOK(nil, "")
}