From 72c3ea3872424fba6b564de9d722acd74e6ecedc Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 29 Nov 2017 20:13:59 -0600 Subject: [PATCH 1/3] include tags into dummy application DeliverTx response Refs https://github.com/tendermint/tendermint/pull/835 --- example/dummy/dummy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index 65d524cfe..45462c535 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -35,7 +35,8 @@ func (app *DummyApplication) DeliverTx(tx []byte) types.ResponseDeliverTx { } else { app.state.Set(tx, tx) } - return types.ResponseDeliverTx{Code: types.CodeType_OK} + tags := []*types.KVPair{{Key: "app.creator", ValueType: types.KVPair_STRING, ValueString: "jae"}} + return types.ResponseDeliverTx{Code: types.CodeType_OK, Tags: tags} } func (app *DummyApplication) CheckTx(tx []byte) types.ResponseCheckTx { From 3b994b4e8a824d69b6973ae6154c274b382c9d9e Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 30 Nov 2017 02:45:40 +0000 Subject: [PATCH 2/3] dummy: include app.key tag --- example/dummy/dummy.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index 45462c535..30eaff284 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -1,8 +1,8 @@ package dummy import ( + "bytes" "fmt" - "strings" "github.com/tendermint/abci/types" wire "github.com/tendermint/go-wire" @@ -29,13 +29,19 @@ func (app *DummyApplication) Info(req types.RequestInfo) (resInfo types.Response // tx is either "key=value" or just arbitrary bytes func (app *DummyApplication) DeliverTx(tx []byte) types.ResponseDeliverTx { - parts := strings.Split(string(tx), "=") + var key, value []byte + parts := bytes.Split(tx, []byte("=")) if len(parts) == 2 { - app.state.Set([]byte(parts[0]), []byte(parts[1])) + key, value = parts[0], parts[1] } else { - app.state.Set(tx, tx) + key, value = tx, tx + } + app.state.Set(key, value) + + tags := []*types.KVPair{ + {Key: "app.creator", ValueType: types.KVPair_STRING, ValueString: "jae"}, + {Key: "app.key", ValueType: types.KVPair_STRING, ValueString: string(key)}, } - tags := []*types.KVPair{{Key: "app.creator", ValueType: types.KVPair_STRING, ValueString: "jae"}} return types.ResponseDeliverTx{Code: types.CodeType_OK, Tags: tags} } From 32a6545604367681017fc91c1866f987518f8e88 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 30 Nov 2017 03:02:48 +0000 Subject: [PATCH 3/3] changelog [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44db318bf..6937eaeb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ BREAKING CHANGES: FEATURES: - [types] added Tags field to ResponseDeliverTx - [types] added Gas and Fee fields to ResponseCheckTx + - [dummy] DeliverTx returns tags ## 0.7.1 (November 14, 2017)