Skip to content

Commit

Permalink
check if deliverTxResCh is still open, return an err otherwise
Browse files Browse the repository at this point in the history
Fixes #2408
  • Loading branch information
melekes committed Nov 29, 2018
1 parent 44b769b commit 669eeff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ program](https://hackerone.com/tendermint).
- keep accums averaged near 0
- [types] \#2941 Preserve val.Accum during ValidatorSet.Update to avoid it being
reset to 0 every time a validator is updated
- [rpc] \#2408 `/broadcast_tx_commit`: Fix interface conversion: interface {} in nil, not EventDataTx error
5 changes: 4 additions & 1 deletion rpc/core/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
// TODO: configurable?
var deliverTxTimeout = rpcserver.WriteTimeout / 2
select {
case deliverTxResMsg := <-deliverTxResCh: // The tx was included in a block.
case deliverTxResMsg, ok := <-deliverTxResCh: // The tx was included in a block.
if !ok {
return nil, errors.New("Error on broadcastTxCommit: expected DeliverTxResult, got nil. Did the Tendermint stop?")
}
deliverTxRes := deliverTxResMsg.(types.EventDataTx)
return &ctypes.ResultBroadcastTxCommit{
CheckTx: *checkTxRes,
Expand Down

0 comments on commit 669eeff

Please sign in to comment.