From 9010ff5f964447e89edd921866bbec9efb3cf753 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 12 Jun 2019 15:25:47 +0200 Subject: [PATCH] types: do not ignore errors returned by PublishWithEvents (#3722) Follow up to #3643 * update changelog * do not ignore errors returned by PublishWithEvents --- CHANGELOG_PENDING.md | 36 +++++++++++++++++------------------- types/event_bus.go | 6 ++---- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index c23dd76b..b1b09e20 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -4,26 +4,25 @@ ### BREAKING CHANGES: -- \#3613 Switch from golang/dep to Go 1.11 Modules to resolve dependencies: - - it is recommended to switch to Go Modules if your project has tendermint - as a dependency - - read more on Modules here: https://github.com/golang/go/wiki/Modules - * CLI/RPC/Config - * [rpc] \#3616 Improve `/block_results` response format (`results.DeliverTx` -> - `results.deliver_tx`). See docs for details. + - [cli] \#3613 Switch from golang/dep to Go Modules to resolve dependencies: + It is recommended to switch to Go Modules if your project has tendermint as + a dependency. Read more on Modules here: + https://github.com/golang/go/wiki/Modules + - [rpc] \#3616 Improve `/block_results` response format (`results.DeliverTx` + -> `results.deliver_tx`). See docs for details. * Apps - * [abci] \#1859 `ResponseCheckTx`, `ResponseDeliverTx`, `ResponseBeginBlock`, - and `ResponseEndBlock` now include `Events` instead of `Tags`. Each `Event` - contains a `type` and a list of `attributes` (list of key-value pairs) allowing - for inclusion of multiple distinct events in each response. + - [abci] \#1859 `ResponseCheckTx`, `ResponseDeliverTx`, `ResponseBeginBlock`, + and `ResponseEndBlock` now include `Events` instead of `Tags`. Each `Event` + contains a `type` and a list of `attributes` (list of key-value pairs) + allowing for inclusion of multiple distinct events in each response. * Go API - * [libs/db] Removed deprecated `LevelDBBackend` const - * If you have `db_backend` set to `leveldb` in your config file, please + - [libs/db] [\#3632](https://github.com/tendermint/tendermint/pull/3632) Removed deprecated `LevelDBBackend` const + If you have `db_backend` set to `leveldb` in your config file, please change it to `goleveldb` or `cleveldb`. -- [p2p] \#3521 Remove NewNetAddressStringWithOptionalID + - [p2p] \#3521 Remove NewNetAddressStringWithOptionalID * Blockchain Protocol @@ -32,10 +31,9 @@ ### FEATURES: ### IMPROVEMENTS: -- [p2p] \#3666 Add per channel telemtry to improve reactor observability - -* [rpc] [\#3686](https://github.com/tendermint/tendermint/pull/3686) `HTTPClient#Call` returns wrapped errors, so a caller could use `errors.Cause` to retrieve an error code. +- [p2p] \#3666 Add per channel telemetry to improve reactor observability +- [rpc] [\#3686](https://github.com/tendermint/tendermint/pull/3686) `HTTPClient#Call` returns wrapped errors, so a caller could use `errors.Cause` to retrieve an error code. (@wooparadog) ### BUG FIXES: -- [libs/db] Fixed the BoltDB backend's Batch.Delete implementation (@Yawning) -- [libs/db] Fixed the BoltDB backend's Get and Iterator implementation (@Yawning) +- [libs/db] \#3717 Fixed the BoltDB backend's Batch.Delete implementation (@Yawning) +- [libs/db] \#3718 Fixed the BoltDB backend's Get and Iterator implementation (@Yawning) diff --git a/types/event_bus.go b/types/event_bus.go index 9c50d643..b91340c7 100644 --- a/types/event_bus.go +++ b/types/event_bus.go @@ -130,8 +130,7 @@ func (b *EventBus) PublishEventNewBlock(data EventDataNewBlock) error { // add predefined new block event events[EventTypeKey] = append(events[EventTypeKey], EventNewBlock) - _ = b.pubsub.PublishWithEvents(ctx, data, events) - return nil + return b.pubsub.PublishWithEvents(ctx, data, events) } func (b *EventBus) PublishEventNewBlockHeader(data EventDataNewBlockHeader) error { @@ -170,8 +169,7 @@ func (b *EventBus) PublishEventTx(data EventDataTx) error { events[TxHashKey] = append(events[TxHashKey], fmt.Sprintf("%X", data.Tx.Hash())) events[TxHeightKey] = append(events[TxHeightKey], fmt.Sprintf("%d", data.Height)) - _ = b.pubsub.PublishWithEvents(ctx, data, events) - return nil + return b.pubsub.PublishWithEvents(ctx, data, events) } func (b *EventBus) PublishEventNewRoundStep(data EventDataRoundState) error {