From 46e1f1ae653a49f18ae813fc3a441edf219f0ce5 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 19 Oct 2017 14:43:34 +0200 Subject: [PATCH] Cleaup based on Antons PR comments --- example/dummy/dummy.go | 6 ++---- example/dummy/persistent_dummy.go | 7 ++++--- tests/test_cli/test.sh | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index 89f997a48..7e95c859b 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -1,7 +1,6 @@ package dummy import ( - "fmt" "strings" "github.com/tendermint/abci/types" @@ -34,7 +33,6 @@ func (app *DummyApplication) DeliverTx(tx []byte) types.Result { } else { app.state.Set(tx, tx) } - fmt.Println("set data") return types.OK } @@ -63,7 +61,7 @@ func (app *DummyApplication) Commit() types.Result { func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) { if reqQuery.Prove { value, proof, err := app.state.GetWithProof(reqQuery.Data) - // be stupid here + // if this wasn't a dummy app, we'd do something smarter if err != nil { panic(err) } @@ -71,7 +69,7 @@ func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types. resQuery.Key = reqQuery.Data resQuery.Value = value resQuery.Proof = wire.BinaryBytes(proof) - if value == nil { + if value != nil { resQuery.Log = "exists" } else { resQuery.Log = "does not exist" diff --git a/example/dummy/persistent_dummy.go b/example/dummy/persistent_dummy.go index cc2d2d400..94ce85adf 100644 --- a/example/dummy/persistent_dummy.go +++ b/example/dummy/persistent_dummy.go @@ -89,14 +89,14 @@ func (app *PersistentDummyApplication) CheckTx(tx []byte) types.Result { } func (app *PersistentDummyApplication) Commit() types.Result { - app.height = app.blockHeader.Height + h := app.blockHeader.Height // Save a new version var appHash []byte var err error if app.app.state.Size() > 0 { - appHash, err = app.app.state.SaveVersion(app.height) + appHash, err = app.app.state.SaveVersion(h) if err != nil { // if this wasn't a dummy app, we'd do something smarter panic(err) @@ -104,7 +104,8 @@ func (app *PersistentDummyApplication) Commit() types.Result { app.logger.Info("Saved state", "root", appHash) } - app.logger.Info("Commit block", "height", app.height, "root", appHash) + app.height = h + app.logger.Info("Commit block", "height", h, "root", appHash) return types.NewResultOK(appHash, "") } diff --git a/tests/test_cli/test.sh b/tests/test_cli/test.sh index 8ea8d545b..4266dd16f 100644 --- a/tests/test_cli/test.sh +++ b/tests/test_cli/test.sh @@ -15,7 +15,6 @@ function testExample() { echo "Example $N" $APP &> /dev/null & - # $APP &> ./app.out & sleep 2 abci-cli --verbose batch < "$INPUT" > "${INPUT}.out.new" killall "$APP"